Author: reebalazs
Date: Tue Dec 25 12:59:17 2007
New Revision: 50087

Modified:
   kukit/kukit.js/branch/ree-service-layer-and-refactoring/   (props changed)
   kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js
   kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/plugin.js
Log:
Convert core plugins to use Each bind iterator instead of
      EachLegacy. Since these plugins called makeExecuteActionsHook
      themselves, it resulted in double calling each time,
      since the EachLegacy iterator needed to prefetch them.
      This may break third party plugin code that reuses unpublished
      internals from plugins.js. (Most particularly, the more_selectors
      demo needed to be updated as well.)


Modified: 
kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js
==============================================================================
--- kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js   
(original)
+++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/eventreg.js   
Tue Dec 25 12:59:17 2007
@@ -746,7 +746,6 @@
 
 
 // This calls the bind method by each bound oper one by one.
-// Eventname and funcToBind are passed too.
 // this is the preferred ([Each]) way. Parameters are different from 
EachLegacy.
 _OperRegistry.prototype._iterateEach =
     function (iteration, binder) {

Modified: 
kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/plugin.js     
(original)
+++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/plugin.js     
Tue Dec 25 12:59:17 2007
@@ -139,46 +139,53 @@
 };
 
 kukit.pl.NativeEventBinder.prototype.__bind__node =
-    function(name, func_to_bind, oper) {
+    function(oper) {
 ;;; if (oper.node == null) {
-;;;     throw new Error('Native event [' + name + '] must be bound to a 
node.');
+;;;     throw new Error('Native event [' + oper.getEventName() + '] must be 
bound to a node.');
 ;;; }
-    this.__bind__(name, func_to_bind, oper);
+    this.__bind__(oper);
 };
 
 kukit.pl.NativeEventBinder.prototype.__bind__nodeorwindow = 
-    function(name, func_to_bind, oper) {
+    function(oper) {
     if (oper.node == null) {
         oper.node = window;
     }
-    this.__bind__(name, func_to_bind, oper);
+    this.__bind__(oper);
 };
 
 kukit.pl.NativeEventBinder.prototype.__bind__window =
-    function(name, func_to_bind, oper) {
+    function(oper) {
 ;;; if (oper.node != null) {
-;;;     throw new Error('Native event [' + name + '] must not be bound to a 
node.');
+;;;     throw new Error('Native event [' + oper.getEventName() + '] must not 
be bound to a node.');
 ;;; }
     oper.node = window;
-    this.__bind__(name, func_to_bind, oper);
+    this.__bind__(oper);
 };
 
 kukit.pl.NativeEventBinder.prototype.__bind__nodeordocument = 
-    function(name, func_to_bind, oper) {
+    function(oper) {
     if (oper.node == null) {
         oper.node = document;
     }
-    this.__bind__(name, func_to_bind, oper);
+    this.__bind__(oper);
 };
 
 kukit.pl.NativeEventBinder.prototype.__bind__ = 
-    function(name, func_to_bind, oper) {
+    function(oper, name) {
 ;;; oper.componentName = 'native event binding';
     oper.evaluateParameters([], 
         {'preventdefault': '', 'allowbubbling': '', 'preventbubbling': ''});
     oper.evalBool('preventdefault');
     oper.evalBool('allowbubbling');
     oper.evalBool('preventbubbling');
+    // name makes it possible to inherit this method and
+    // bind it physically to a given browser event
+    if (typeof(name) == 'undefined') {
+        // Event name is normally acquired from the oper.
+        name = oper.getEventName();
+    }
+    //
     if (oper.parms.preventdefault) {
         if (name != 'click') {
 ;;;         kukit.E = 'In native events only the click event can have';
@@ -195,8 +202,6 @@
     // (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')) {
@@ -207,7 +212,7 @@
 };
 
 kukit.pl.NativeEventBinder.prototype.__bind_key__ =
-    function(name, func_to_bind, oper) {
+    function(oper) {
 ;;; oper.componentName = 'native key event binding';
     oper.evaluateParameters([],
         {'preventdefault': 'true', 'allowbubbling': '',
@@ -287,42 +292,42 @@
 *  Unsupported are those with absolute no hope to work in a cross browser way
 *  Preventdefault is only allowed for click and key events, currently
 */
-kukit.eventsGlobalRegistry.register(null, 'blur', kukit.pl.NativeEventBinder,
-    '__bind__nodeorwindow', null);
-kukit.eventsGlobalRegistry.register(null, 'focus', kukit.pl.NativeEventBinder,
-    '__bind__nodeorwindow', null);
-kukit.eventsGlobalRegistry.register(null, 'resize', kukit.pl.NativeEventBinder,
-    '__bind__nodeorwindow', null);
-kukit.eventsGlobalRegistry.register(null, 'click', kukit.pl.NativeEventBinder,
-    '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'dblclick',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'mousedown',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'mouseup',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'mousemove',
-    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null);
-kukit.eventsGlobalRegistry.register(null, 'mouseover',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'mouseout',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'change',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'reset',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'select',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'submit',
-    kukit.pl.NativeEventBinder, '__bind__node', null);
-kukit.eventsGlobalRegistry.register(null, 'keydown',
-    kukit.pl.NativeEventBinder, '__bind_key__', null);
-kukit.eventsGlobalRegistry.register(null, 'keypress',
-    kukit.pl.NativeEventBinder, '__bind_key__', null);
-kukit.eventsGlobalRegistry.register(null, 'keyup',
-    kukit.pl.NativeEventBinder, '__bind_key__', null);
-//kukit.eventsGlobalRegistry.register(null, 'unload',
-//    kukit.pl.NativeEventBinder, '__bind__window', null);
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'blur', 
kukit.pl.NativeEventBinder,
+    '__bind__nodeorwindow', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'focus', 
kukit.pl.NativeEventBinder,
+    '__bind__nodeorwindow', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'resize', 
kukit.pl.NativeEventBinder,
+    '__bind__nodeorwindow', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'click', 
kukit.pl.NativeEventBinder,
+    '__bind__nodeordocument', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'dblclick',
+    kukit.pl.NativeEventBinder, '__bind__node', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'mousedown',
+    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'mouseup',
+    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'mousemove',
+    kukit.pl.NativeEventBinder, '__bind__nodeordocument', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'mouseover',
+    kukit.pl.NativeEventBinder, '__bind__node', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'mouseout',
+    kukit.pl.NativeEventBinder, '__bind__node', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'change',
+    kukit.pl.NativeEventBinder, '__bind__node', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'reset',
+    kukit.pl.NativeEventBinder, '__bind__node', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'select',
+    kukit.pl.NativeEventBinder, '__bind__node', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'submit',
+    kukit.pl.NativeEventBinder, '__bind__node', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'keydown',
+    kukit.pl.NativeEventBinder, '__bind_key__', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'keypress',
+    kukit.pl.NativeEventBinder, '__bind_key__', null, 'Each');
+kukit.eventsGlobalRegistry.registerForAllEvents(null, 'keyup',
+    kukit.pl.NativeEventBinder, '__bind_key__', null, 'Each');
+//kukit.eventsGlobalRegistry.registerForAllEvents(null, 'unload',
+//    kukit.pl.NativeEventBinder, '__bind__window', null, 'Each');
 
 /*
 * class TimeoutEventBinder
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to