Author: reebalazs
Date: Sun Dec 30 13:53:16 2007
New Revision: 50196
Modified:
kukit/kukit.js/branch/finish-closures/kukit/plugin.js
Log:
Trivial but important fix for registerBrowserEvent: the name parameter must be
provided when we bind to different browser event than the kss event.
Modified: kukit/kukit.js/branch/finish-closures/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/plugin.js (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/plugin.js Sun Dec 30
13:53:16 2007
@@ -131,7 +131,23 @@
;;; kukit.log(msg);
}
};
+
+ // register the event listener
kukit.ut.registerEventListener(oper.node, eventName, func);
+
+ //
+ // XXX Safari hack
+ // necessary since Safari does not prevent the <a href...> following
+ // (in case of allowbubbling we have to apply it to all clicks, as there
+ // might be a link inside that we cannot detect on the current node)
+ //
+ if (oper.parms.preventdefault && kukit.HAVE_SAFARI
+ && (oper.parms.allowbubbling || eventName == 'click'
+ && oper.node.tagName.toLowerCase() == 'a')) {
+ oper.node.onclick = function cancelClickSafari() {
+ return false;
+ };
+ }
};
/*
@@ -182,23 +198,9 @@
throw new Error(kukit.E);
}
}
- pl.registerBrowserEvent(oper);
- //
- // XXX Safari hack
- // necessary since Safari does not prevent the <a href...> following
- // (in case of allowbubbling we have to apply it to all clicks, as there
- // might be a link inside that we cannot detect on the current node)
- //
- // XXX not needed since we have the legacy name parameter:
- // var name = oper.getEventName();
- if (oper.parms.preventdefault && kukit.HAVE_SAFARI
- && (oper.parms.allowbubbling || name == 'click'
- && oper.node.tagName.toLowerCase() == 'a')) {
- var cancelClickSafari = function() {
- return false;
- };
- oper.node.onclick = cancelClickSafari;
- }
+ // we give the name parameter to the registration, so we
+ // really bind to the event name we want.
+ pl.registerBrowserEvent(oper, null, name);
};
this.__bind_key__ =
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins