Author: gotcha
Date: Mon Dec 24 12:24:43 2007
New Revision: 50057

Modified:
   kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
   kukit/kukit.js/branch/finish-closures/kukit/dom.js
Log:
unindent and initialize

Modified: kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/TODO.txt        (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/TODO.txt        Mon Dec 24 
12:24:43 2007
@@ -5,7 +5,6 @@
 files where indentation has to be undone and initialize needs to be done
 
 dom.js
-errors.js
 eventreg.js
 forms.js
 kssparser.js

Modified: kukit/kukit.js/branch/finish-closures/kukit/dom.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/dom.js  (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/dom.js  Mon Dec 24 12:24:43 2007
@@ -317,8 +317,9 @@
 *
 *  Scheduler for embedded window content loaded
 */
-dom.EmbeddedContentLoadedScheduler =
-    function(framename, func, autodetect) {
+dom.EmbeddedContentLoadedScheduler = function() {
+
+this.initialize = function(framename, func, autodetect) {
     this.framename = framename;
     this.func = func;
     this.autodetect = autodetect;
@@ -331,73 +332,75 @@
     //this.counter.timeout();
     // XXX can't execute immediately, it fails on IE.
     this.counter.start();
+};
 
-    this.check = function() {
+this.check = function() {
+    
+;;; kukit.logDebug('Is iframe loaded ?');
+    
+    var doc = _getIframeDocument(this.framename);
+
+    // quit if the init function has already been called
+    // XXX I believe we want to call the function too, then
+    // XXX attribute access starting with _ breaks full compression,
+    // even in strings
+    //if (doc._embeddedContentLoadedInitDone) {
+    if (doc['_' + 'embeddedContentLoadedInitDone']) {
+;;;     var msg = 'Iframe already initialized, but we execute the action';
+;;;     msg += ' anyway, as requested.';
+;;;     kukit.logWarning(msg);
+        this.counter.restart = false;
+    }
+
+    // autodetect=false implements a more reliable detection method
+    // that involves cooperation from the internal document. In this
+    // case the internal document sets the _kssReadyForLoadEvent attribute
+    // on the document, when loaded. It is safe to check for this in any 
+    // case, however if this option is selected, we rely only on this, 
+    // and skip the otherwise problematic default checking.
+    // XXX attribute access starting with _ breaks full compression,
+    // even in strings
+    //if (typeof doc._kssReadyForLoadEvent != 'undefined') {
+    if (typeof doc['_' + 'kssReadyForLoadEvent'] != 'undefined') {
+        this.counter.restart = false;
+    } 
+
+    if (this.autodetect && this.counter.restart) {
+
+        // obviously we are not there... this happens on FF
+        if (doc.location.href == 'about:blank') {
+            return;
+        } /* */
         
-;;;    kukit.logDebug('Is iframe loaded ?');
+        // First check for Safari or
+        // if DOM methods are supported, and the body element exists
+        // (using a double-check including document.body,
+        // for the benefit of older moz builds [eg ns7.1] 
+        // in which getElementsByTagName('body')[0] is undefined,
+        // unless this script is in the body section)
         
-        var doc = _getIframeDocument(this.framename);
-
-        // quit if the init function has already been called
-        // XXX I believe we want to call the function too, then
-        // XXX attribute access starting with _ breaks full compression,
-        // even in strings
-        //if (doc._embeddedContentLoadedInitDone) {
-        if (doc['_' + 'embeddedContentLoadedInitDone']) {
-;;;        var msg = 'Iframe already initialized, but we execute the action';
-;;;        msg += ' anyway, as requested.';
-;;;        kukit.logWarning(msg);
+        if(/KHTML|WebKit/i.test(navigator.userAgent)) {
+            if(/loaded|complete/.test(doc.readyState)) {
+                this.counter.restart = false;
+            }
+        } else if(typeof doc.getElementsByTagName != 'undefined'
+            && (doc.getElementsByTagName('body')[0] != null ||
+                doc.body != null)) {
             this.counter.restart = false;
-        }
+        } /* */
+
+    }
 
-        // autodetect=false implements a more reliable detection method
-        // that involves cooperation from the internal document. In this
-        // case the internal document sets the _kssReadyForLoadEvent attribute
-        // on the document, when loaded. It is safe to check for this in any 
-        // case, however if this option is selected, we rely only on this, 
-        // and skip the otherwise problematic default checking.
+    if ( ! this.counter.restart) {
+;;;     kukit.logDebug('Yes, iframe is loaded.');
         // XXX attribute access starting with _ breaks full compression,
         // even in strings
-        //if (typeof doc._kssReadyForLoadEvent != 'undefined') {
-        if (typeof doc['_' + 'kssReadyForLoadEvent'] != 'undefined') {
-            this.counter.restart = false;
-        } 
-
-        if (this.autodetect && this.counter.restart) {
-
-            // obviously we are not there... this happens on FF
-            if (doc.location.href == 'about:blank') {
-                return;
-            } /* */
-            
-            // First check for Safari or
-            // if DOM methods are supported, and the body element exists
-            // (using a double-check including document.body,
-            // for the benefit of older moz builds [eg ns7.1] 
-            // in which getElementsByTagName('body')[0] is undefined,
-            // unless this script is in the body section)
-            
-            if(/KHTML|WebKit/i.test(navigator.userAgent)) {
-                if(/loaded|complete/.test(doc.readyState)) {
-                    this.counter.restart = false;
-                }
-            } else if(typeof doc.getElementsByTagName != 'undefined'
-                && (doc.getElementsByTagName('body')[0] != null ||
-                    doc.body != null)) {
-                this.counter.restart = false;
-            } /* */
-
-        }
-
-        if ( ! this.counter.restart) {
-;;;        kukit.logDebug('Yes, iframe is loaded.');
-            // XXX attribute access starting with _ breaks full compression,
-            // even in strings
-            // doc._embeddedContentLoadedInitDone = true;
-            doc['_' + 'embeddedContentLoadedInitDone'] = true;
-            this.func();
-        }
-    };
+        // doc._embeddedContentLoadedInitDone = true;
+        doc['_' + 'embeddedContentLoadedInitDone'] = true;
+        this.func();
+    }
+};
+this.initialize.apply(this, arguments);
 };
 
 dom.getNsTags = function(dom_obj, tagName) {
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to