diff options
author | Thomas BrĂ¼derli | 2008-01-30 14:24:43 +0000 |
---|---|---|
committer | Thomas BrĂ¼derli | 2008-01-30 14:24:43 +0000 |
commit | 02f6299ec3ce723f2cb15ce3b62ee578ded5a7d1 (patch) | |
tree | a2f940d8ba4d4e3999be7a6c1bb0c47c1ca46422 /itjs | |
parent | 2c73aef67a66d0f8a26dbe5ecbb9b1d30b3ce314 (diff) | |
download | itools-02f6299ec3ce723f2cb15ce3b62ee578ded5a7d1.tar.gz itools-02f6299ec3ce723f2cb15ce3b62ee578ded5a7d1.tar.bz2 itools-02f6299ec3ce723f2cb15ce3b62ee578ded5a7d1.zip |
Fix fallback to <script> tags
Diffstat (limited to 'itjs')
-rw-r--r-- | itjs/loader.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/itjs/loader.js b/itjs/loader.js index b5e0a44..0fa7c4e 100644 --- a/itjs/loader.js +++ b/itjs/loader.js @@ -10,6 +10,7 @@ function it_loader(handler) this.handler = handler; this.instance = it_loader.instances++; this.callid = 0; + this.scrpt = []; this.clear(); } @@ -121,20 +122,21 @@ load: function(baseurl, pos, num, query_volatile, retry) if (!use_script || (window.opera && !window.XMLHttpRequest)) // Opera 7 only works with iframes { - this.scrpt = document.createElement("iframe"); - this.scrpt.style.width = this.scrpt.style.height = 1; + var scrpt = document.createElement("iframe"); + scrpt.style.width = scrpt.style.height = 1; req_url += "&itjs_iframe=1"; } else - this.scrpt = document.createElement("script"); + var scrpt = document.createElement("script"); it_loader['__inst' + this.instance] = this; this.req = { starttime: this.starttime, retry: retry }; try { - if (!document.all) this.scrpt.src = req_url; - document.body.appendChild(this.scrpt); - if (document.all) this.scrpt.src = req_url; + this.scrpt[this.callid] = scrpt; + if (!document.all) scrpt.src = req_url; + document.body.appendChild(scrpt); + if (document.all) scrpt.src = req_url; } catch (e) { return false; } } @@ -236,7 +238,7 @@ dataReady: function(data, callid) it_loader.sequence += "h"; } - this.unlink(); + this.unlink(callid); }, stop: function() @@ -247,21 +249,21 @@ stop: function() } catch (e) { } - this.unlink(); + this.unlink(this.callid); }, -unlink: function() +unlink: function(callid) { - if (it_loader['__inst' + this.instance]) + if (it_loader['__inst' + this.instance] && callid == this.callid) it_loader['__inst' + this.instance] = null; if (this.req) this.req = null; - if (this.scrpt) + if (this.scrpt[callid]) { - document.body.removeChild(this.scrpt); - this.scrpt = null; + document.body.removeChild(this.scrpt[callid]); + this.scrpt[callid] = null; } it_loader.sequence = ""; |