[KSS-checkins] r36047 - kukit/kukit.js/branch/1.0/kukit

reebalazs at codespeak.net reebalazs at codespeak.net
Fri Dec 29 22:19:13 CET 2006


Author: reebalazs
Date: Fri Dec 29 22:19:11 2006
New Revision: 36047

Modified:
   kukit/kukit.js/branch/1.0/kukit/plugin.js
   kukit/kukit.js/branch/1.0/kukit/utils.js
Log:
Backport of fix from trunk (timer event binder should delete itself, in case the node it executed on, has been deleted in the meantime)

Modified: kukit/kukit.js/branch/1.0/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/branch/1.0/kukit/plugin.js	(original)
+++ kukit/kukit.js/branch/1.0/kukit/plugin.js	Fri Dec 29 22:19:11 2006
@@ -195,9 +195,9 @@
 
 // Timer events. The binding of this event will start one counter
 // per event rule. No matter how many nodes matched it. 
-// The timer will tick for ever (i.e. won't stop
-// even if the binding nodes are all deleted)
-// or only once if repeat=false is given.
+// The timer will tick for ever,
+// unless the binding node has been deleted, in which case it stops,
+// or it runs only once if repeat=false is given.
 
 kukit.pl.TimeoutEventBinder = function() {
     this.counters = {};
@@ -215,7 +215,18 @@
     } else {   
         kukit.logDebug('timer event key entered for actionEvent #' + key + ' ' 
             + oper.eventrule.kss_selector.css);
-        var counter = new kukit.ut.TimerCounter(oper.parms.delay, func_to_bind, oper.parms.repeat); 
+        var f = function() {
+            // check if the node has been deleted
+            // and weed it out if so
+            if (oper.node != null && ! oper.node.parentNode) {
+                kukit.logDebug('timer deleted for actionEvent #' + key + ' ' 
+                    + oper.eventrule.kss_selector.css);
+                this.clear();
+            } else {
+                func_to_bind();
+            }
+        };
+        var counter = new kukit.ut.TimerCounter(oper.parms.delay, f, oper.parms.repeat); 
         this.counters[key] = counter;
         // Start the counter
         counter.start();

Modified: kukit/kukit.js/branch/1.0/kukit/utils.js
==============================================================================
--- kukit/kukit.js/branch/1.0/kukit/utils.js	(original)
+++ kukit/kukit.js/branch/1.0/kukit/utils.js	Fri Dec 29 22:19:11 2006
@@ -262,6 +262,7 @@
     if (this.timer) {
         window.clearTimeout(this.timer);
     }
+    this.restart = false;
 };
 
 


More information about the Kukit-checkins mailing list