Author: gotcha
Date: Tue Feb 20 13:14:26 2007
New Revision: 39225
Modified:
kukit/kukit.js/trunk/kukit/dom.js
kukit/kukit.js/trunk/kukit/forms.js
kukit/kukit.js/trunk/kukit/kukit.js
kukit/kukit.js/trunk/kukit/plugin.js
Log:
* onDOMLoad compatibility issues with kupu initialization
* needs to be refactored properly
Modified: kukit/kukit.js/trunk/kukit/dom.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/dom.js (original)
+++ kukit/kukit.js/trunk/kukit/dom.js Tue Feb 20 13:14:26 2007
@@ -303,6 +303,7 @@
this.func = func;
var self = this;
var f = function() {
+ kukit.logDebug('Is iframe loaded ?');
self.check();
};
this.counter = new kukit.ut.TimerCounter(250, f, true);
@@ -332,22 +333,32 @@
if (doc._embeddedContentLoadedInitDone) {
return;
}
+
// obviously we are not there... this happens on FF
+
+ /*Commented out by GC
if (doc.location.href == 'about:blank') {
return;
- }
+ }*/
+
+ if (typeof doc._kssReadyForLoadEvent != 'undefined') {
+ this.counter.restart = false;
+ }
// 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)
+
+ /*Commented out by GC
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.');
doc._embeddedContentLoadedInitDone = true;
this.func();
}
Modified: kukit/kukit.js/trunk/kukit/forms.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/forms.js (original)
+++ kukit/kukit.js/trunk/kukit/forms.js Tue Feb 20 13:14:26 2007
@@ -237,9 +237,9 @@
/* With editors, there are two main points of handling:
1. we need to load them after injected dynamically
- 2. we need to prepare the form before we want to use the form variables
+ 2. we need to update the form before we accces the form variables
- Every editor has to register the field on their custody.
+ Any editor has to register the field on their custody.
The update handler will be called automatically, when a form
value is about to be fetched.
*/
Modified: kukit/kukit.js/trunk/kukit/kukit.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/kukit.js (original)
+++ kukit/kukit.js/trunk/kukit/kukit.js Tue Feb 20 13:14:26 2007
@@ -42,6 +42,7 @@
this.binderInfoRegistry = new kukit.er.BinderInfoRegistry();
// instantiate a load scheduler
this.loadScheduler = new kukit.rd.LoadActions();
+ this.initializedOnDOMLoad = false;
};
kukit.Engine.prototype.calculateBase = function() {
@@ -157,7 +158,7 @@
kukit.Engine.prototype.initializeRules = function() {
if (window.kukitRulesInitializing || window.kukitRulesInitialized) {
// Refuse to initialize a second time.
- kukit.log('Subsequent call to initializeRules is ignored');
+ kukit.log('Subsequent call to initializeRules is ignored !');
return;
}
// Succesful initialization. At the moment the engine is kept
@@ -240,6 +241,18 @@
// Subsequent activations will not delete the already set up engine.
// Subsequent activations may happen, if more event handlers are set up,
// and the first one will do the job, the later ones are ignored.
+ kukit.log('bootstrap')
+ engine.initializeRules();
+};
+
+kukit.bootstrapFromDOMLoad = function() {
+ var engine = new kukit.Engine();
+ // Successful initializeRules will store the engine as kukit.engine.
+ // Subsequent activations will not delete the already set up engine.
+ // Subsequent activations may happen, if more event handlers are set up,
+ // and the first one will do the job, the later ones are ignored.
+ engine.initializedOnDOMLoad = true;
+ kukit.log('bootstrap from DOMLoad')
engine.initializeRules();
};
Modified: kukit/kukit.js/trunk/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/plugin.js (original)
+++ kukit/kukit.js/trunk/kukit/plugin.js Tue Feb 20 13:14:26 2007
@@ -270,7 +270,8 @@
kukit.logDebug('EventRule #' + oper.eventrule.getNr() + ' mergeid ' +
oper.eventrule.kss_selector.mergeid + ' event ignored, oninsert=false.');
return;
}
- if (oper.node != null && oper.node.tagName.toLowerCase() == 'iframe' &&
phase == 2) {
+ if (oper.node != null && oper.node.tagName.toLowerCase() == 'iframe' &&
+ (phase == 2 || (phase == 1 &&
kukit.engine.initializedOnDOMLoad))) {
kukit.logDebug('EventRule #' + oper.eventrule.getNr() + ' mergeid ' +
oper.eventrule.kss_selector.mergeid + ' event selected delayed execution (when
iframe loaded)');
// We want the event execute once the iframe is loaded.
var f = function() {
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins