changeset 77:7854e036a572

Fix a problem that made events without data called only once.
author Sonny Piers <sonny.piers@gmail.com>
date Mon, 06 Feb 2012 18:03:06 +0100
parents 0b8e7ca19f83
children 4d0fc1c9ec88
files lightstring.js
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lightstring.js
+++ b/lightstring.js
@@ -334,6 +334,15 @@ Lightstring.Connection.prototype = {
     if (!handlers)
       return;
 
+    //No data events
+    if(!aData) {
+      for (var i = 0; i < handlers.length; i++)
+        handlers[i].call(this, aData);
+
+      return;
+    }
+
+    //Non-iq events
     if (aData && aData.DOM && aData.DOM.localName !== 'iq') {
       for (var i = 0; i < handlers.length; i++)
         handlers[i].call(this, aData);
@@ -341,6 +350,7 @@ Lightstring.Connection.prototype = {
       return;
     }
 
+    //Iq events
     var ret;
     for (var i = 0; i < handlers.length; i++) {
       ret = handlers[i].call(this, aData);