Author: gotcha
Date: Sat Sep 15 22:44:09 2007
New Revision: 46660

Modified:
   kukit/kukit.js/trunk/kukit/eventreg.js
   kukit/kukit.js/trunk/kukit/kssparser.js
   kukit/kukit.js/trunk/kukit/plugin.js
   kukit/kukit.js/trunk/kukit/resourcedata.js
Log:
merge 46655:46656 from firekiss branch

Modified: kukit/kukit.js/trunk/kukit/eventreg.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/eventreg.js      (original)
+++ kukit/kukit.js/trunk/kukit/eventreg.js      Sat Sep 15 22:44:09 2007
@@ -572,7 +572,7 @@
 };
 
 kukit.er.BinderInfo.prototype.startBindingPhase = function () {
-    // The bindind phase starts and it has the information for
+    // The binding phase starts and it has the information for
     // the currently on-bound events.
     this.binding = new kukit.er.OperRegistry();
 };

Modified: kukit/kukit.js/trunk/kukit/kssparser.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/kssparser.js     (original)
+++ kukit/kukit.js/trunk/kukit/kssparser.js     Sat Sep 15 22:44:09 2007
@@ -456,7 +456,7 @@
 /*
 * class EventValue
 *
-* PropValue in pseudo must ba single word with no spaces around.
+* PropValue in pseudo must be single word with no spaces around.
 */
 kukit.kssp.EventValue = kukit.tk.mkParser('propValue', {
     "{": 'this.emitAndReturn()',
@@ -791,17 +791,6 @@
         // Store event rules in the common list
         for (var i=0; i<parser.eventRules.length; i++) {
             var rule = parser.eventRules[i];
-            // finish up the KSS on it
-;;;         try {
-                rule.kssSelector.setIdAndClass();
-;;;         } catch(e) {
-;;;             kukit.E = 'Undefined event : [';
-;;;             if (rule.kssSelector.namespace != null) {
-;;;                     kukit.E += rule.kssSelector.namespace + ':';
-;;;             }
-;;;             kukit.E += rule.kssSelector.name + '].';
-;;;             throw kukit.err.undefinedEventError(e, kukit.E);
-;;;         }
             this.rules.push(rule);
         }
 ;;; } catch(e) {

Modified: kukit/kukit.js/trunk/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/plugin.js        (original)
+++ kukit/kukit.js/trunk/kukit/plugin.js        Sat Sep 15 22:44:09 2007
@@ -361,7 +361,7 @@
         phase = 1;
     } else {
         // get the phase from the node
-        phase = oper.node._kukitmark;
+        phase = oper.node._kukitMark;
     }
     if (phase == 1 && ! oper.parms.initial) {
 ;;;     var msg = 'EventRule #' + oper.eventRule.getIndex() + ' mergeId [';
@@ -446,7 +446,7 @@
         kukit.engine.bindScheduler.addPost(func_to_bind, remark);
     }
     if (iloadoper) {
-        var phase = iloadoper.node._kukitmark;
+        var phase = iloadoper.node._kukitMark;
         // For phase 2 we need to execute posponed, for phase1 immediately.
         // XXX it would be better not need this and do always postponed.
         if (phase == 2 || (phase == 1 && kukit.engine.initializedOnDOMLoad)) {

Modified: kukit/kukit.js/trunk/kukit/resourcedata.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/resourcedata.js  (original)
+++ kukit/kukit.js/trunk/kukit/resourcedata.js  Sat Sep 15 22:44:09 2007
@@ -41,9 +41,12 @@
 kukit.rd.KssSelector = function(isEvent, css, name, namespace, id) {
     this.isEventSelector = isEvent;
     this.isMethodSelector = ! isEvent;
-    if (! name) {
-        throw new Error('KssSelector must have name');
-    }
+// XXX GC row and column are wrong...
+// XXX move parsing errors to parser
+;;; if (! name) {
+;;;     var msg = 'Kss selector must have a name.';
+;;;     throw kukit.err.kssSelectorError(msg);
+;;; }
 ;;; if (name.indexOf('@') != -1) {
 ;;;     var msg = 'Kss selector name must not contain @: [' + name + '].';
 ;;;     throw kukit.err.kssSelectorError(msg);
@@ -61,7 +64,7 @@
 ;;;     // method rule
 ;;;     if (css != 'document' && css != 'behaviour') {
 ;;;         var msg = 'KssSpecialSelector [' + name;
-;;;         msg = msg + '] must have one of the allowed names';
+;;;         msg = msg + '] must have one of the allowed names.';
 ;;;         throw kukit.err.kssSelectorError(msg);
 ;;;    }
 ;;; }
@@ -70,10 +73,21 @@
     this.namespace = namespace;
     this.className = null;
     this.id = id;
+    // finish up the KSS on it
+    // XXX GC instead of relying on exceptions, test if key exists
+;;; try {
+        this.setIdAndClass();
+;;; } catch(e) {
+;;;     // foolishly, we don't know the position at this point
+;;;     var msg = 'Undefined event : [';
+;;;     msg += namespace + ':' + name + '].';
+;;;     throw kukit.err.kssSelectorError(msg);
+;;; }
 };
 
 kukit.rd.KssSelector.prototype.setIdAndClass = function() {
     // Sets up id and class on the selector, based on registration info
+    // XXX GC instead of relying on exceptions, test if key exists
     this.className = kukit.eventsGlobalRegistry.get(
         this.namespace, this.name).className;
     if (this.id == null) {
@@ -236,7 +250,7 @@
             // XXX never rebind to any node again!
             // this compensates that cssQuery is returning
             // results out of the subtree
-            if (typeof(node._kukitmark) == 'undefined') {
+            if (typeof(node._kukitMark) == 'undefined') {
                 ruletable.add(node, this);
                 counter += 1;
                 }
@@ -273,6 +287,7 @@
 */
 
 kukit.rd.EventRule.prototype.bind = function(node) {
+    this.store(node);
     // Creation of the binding oper
     var oper = new kukit.op.Oper();
     var binderInfo = this.getBinderInfo();
@@ -284,6 +299,13 @@
     binderInfo.bindOper(oper); 
 };
 
+kukit.rd.EventRule.prototype.store = function(node) {
+    if (typeof(node.kukitEventRules) == 'undefined') {
+        var rules = [];
+        node.kukitEventRules = rules;
+    }
+    node.kukitEventRules.push(this);
+};
 
 /*
 * Merging event rules
@@ -680,10 +702,10 @@
     for (var nodehash in this.nodes) {
         var nodeval = this.nodes[nodehash];
         // XXX Mark the node, disabling rebinding in a second round
-        nodeval.node._kukitmark = phase;
+        nodeval.node._kukitMark = phase;
         for (var id in nodeval.val) {
             var eventRule = nodeval.val[id];
-            eventRule.bind(nodeval.node);            
+            eventRule.bind(nodeval.node);
         }
         counter += 1;
     }
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to