[KSS-checkins] r36045 - kukit/kukit.js/trunk/kukit
reebalazs at codespeak.net
reebalazs at codespeak.net
Fri Dec 29 22:16:53 CET 2006
Author: reebalazs
Date: Fri Dec 29 22:16:51 2006
New Revision: 36045
Modified:
kukit/kukit.js/trunk/kukit/plugin.js
kukit/kukit.js/trunk/kukit/utils.js
Log:
timer event binder should delete itself, in case the node it executed on, has been deleted in the meantime.
Modified: kukit/kukit.js/trunk/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/plugin.js (original)
+++ kukit/kukit.js/trunk/kukit/plugin.js Fri Dec 29 22:16:51 2006
@@ -190,9 +190,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 = {};
@@ -210,7 +210,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/trunk/kukit/utils.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/utils.js (original)
+++ kukit/kukit.js/trunk/kukit/utils.js Fri Dec 29 22:16:51 2006
@@ -291,6 +291,7 @@
if (this.timer) {
window.clearTimeout(this.timer);
}
+ this.restart = false;
};
More information about the Kukit-checkins
mailing list