[KSS-checkins] r49897 - kukit/kukit.js/branch/finish-closures/kukit

gotcha at codespeak.net gotcha at codespeak.net
Tue Dec 18 18:44:48 CET 2007


Author: gotcha
Date: Tue Dec 18 18:44:47 2007
New Revision: 49897

Modified:
   kukit/kukit.js/branch/finish-closures/kukit/kukit.js
Log:
fixes for hiccups found with jslint

Modified: kukit/kukit.js/branch/finish-closures/kukit/kukit.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/kukit.js	(original)
+++ kukit/kukit.js/branch/finish-closures/kukit/kukit.js	Tue Dec 18 18:44:47 2007
@@ -17,6 +17,8 @@
 * 02111-1307, USA.
 */
 
+/*global kukit, document, window */
+
 kukit = new function() {   /// MODULE START
 
 var ku = this;
@@ -39,6 +41,14 @@
     return false;
 };
 
+/*
+* class _RuleSheetLink
+*/
+var _RuleSheetLink = function(href, res_type) {
+    this.href = href;
+    this.res_type = res_type;
+};
+
 
 /*
 * class Engine
@@ -48,8 +58,8 @@
     // table from res_type to rule processor
     this._ruleProcessorClasses = {};
     // register processor for type kss
-    this._ruleProcessorClasses['kss'] = kukit.kssp.KssRuleProcessor;
-    this._ruleProcessors = new Array();
+    this._ruleProcessorClasses.kss = kukit.kssp.KssRuleProcessor;
+    this._ruleProcessors = [];
     this.bindScheduler = new kukit.ut.SerializeScheduler();
     // State vars storage. This can be used from kss via a method.
     this.stateVariables = {};
@@ -82,8 +92,8 @@
             }
         }
         nodes = document.getElementsByTagName("base");
-        if (nodes.length == 0) {
-            var base = window.location.href;
+        if (nodes.length === 0) {
+            base = window.location.href;
             var pieces = base.split('/');
             pieces.pop();
             base = pieces.join('/');
@@ -120,16 +130,17 @@
     };
 
     this.createRuleProcessor = function(rulelink) {
-        var ruleProcessorClass = this._ruleProcessorClasses[rulelink.res_type];
-        if (ruleProcessorClass) {
-;;;         var msg = "Start loading and processing " + rulelink.href;
+        var _RuleProcessorClass = this._ruleProcessorClasses[rulelink.res_type];
+;;;     var msg = '';
+        if (_RuleProcessorClass) {
+;;;         msg = "Start loading and processing " + rulelink.href;
 ;;;         msg = msg + " of type " + rulelink.res_type;
 ;;;         kukit.log(msg);
-            var ruleprocessor = new ruleProcessorClass(rulelink.href);
+            var ruleprocessor = new _RuleProcessorClass(rulelink.href);
             this._ruleProcessors[this._ruleProcessors.length] = ruleprocessor;
             return ruleprocessor;
 ;;;     } else {
-;;;         var msg = "Ignore rulesheet " + rulelink.href;
+;;;         msg = "Ignore rulesheet " + rulelink.href;
 ;;;         msg = msg + " of type " + rulelink.res_type;
 ;;;         kukit.log(msg);
         }
@@ -138,8 +149,8 @@
 
 
     this.getRules = function() {
-        var rules = new Array();
-        var ruleProcessors = this._ruleProcessors
+        var rules = [];
+        var ruleProcessors = this._ruleProcessors;
         for (var j=0; j<ruleProcessors.length; j++) {
             var ruleProcessor = ruleProcessors[j];
             for (var i=0; i<ruleProcessor.rules.length; i++) {
@@ -147,11 +158,11 @@
             }
         }
         return rules;
-    }
+    };
 
     this.getRuleProcessors = function() {
-        return this._ruleProcessors
-    }
+        return this._ruleProcessors;
+    };
 
     this.setupEvents = function(inNodes) {
         if (this.setupEventsInProgress) {
@@ -233,6 +244,7 @@
     };
 
     this.initializeRules = function() {
+;;;     var msg = '';
         if (window.kukitRulesInitializing || window.kukitRulesInitialized) {
             // Refuse to initialize a second time.
 ;;;         kukit.log('[initializeRules] is called twice.');
@@ -255,7 +267,7 @@
 ;;;             var ts_loaded = (new Date()).valueOf();
                 ruleprocessor.parse();
 ;;;             var ts_end = (new Date()).valueOf();
-;;;             var msg = "Finished loading and processing " + rulelink.href;
+;;;             msg = "Finished loading and processing " + rulelink.href;
 ;;;             msg += " resource type " + rulelink.res_type;
 ;;;             msg += ' in ' + (ts_loaded - ts_start) + ' + ';
 ;;;             msg += (ts_end - ts_loaded) + ' ms.';
@@ -267,7 +279,7 @@
 ;;;     } catch(e) {
 ;;;         // Event setup errors are logged.
 ;;;         if (e.name == 'RuleMergeError' || e.name == 'EventBindError') {
-;;;            var msg = 'Events setup - ' + e.toString();
+;;;            msg = 'Events setup - ' + e.toString();
 ;;;             // Log the message
 ;;;             kukit.logFatal(msg);
 ;;;             // and throw it...
@@ -295,14 +307,6 @@
     kukit.bootstrap();
 };
 
-/*
-* class _RuleSheetLink
-*/
-var _RuleSheetLink = function(href, res_type) {
-    this.href = href;
-    this.res_type = res_type;
-};
-
 ku.bootstrap = function() {
 ;;; kukit.log('Instantiate engine.');
     var engine = new kukit.Engine();


More information about the Kukit-checkins mailing list