#16992 closed enhancement (duplicate)
injectUrl issue with dojox.layout.ContentPane using require
Reported by: | xangxiong | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Loader | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I want to point out an issue that I've encounter when trying to use the dojox.layout.ContentPane? to load a remote html file that includes some widgets and a require statement.
The injectUrl function in dojo.js seems to have issue using the correct script tag as the sibling if there are any inline script tags with type as dojo/method or dojo/connect. Now keep in mind, this issue only arise if you try to load dojo.js at the bottom of the page after all the dojo/method or dojo/connect. It seems to work fine if dojo.js is loaded before the dojo/method or dojo/connect.
I may be experiencing this issue because I'm not embedding dojo as expected, but it would seem that it should work whether dojo is embedded before or after any dojo/method or dojo/connect as these should not be executed until the page has been loaded and the widgets are created.
I've included two page to help reproduce the issue and a possible work around I am using. It would be nice for a workaround to be added to the injectUrl function to handle such cases as this.
Attachments (2)
Change History (6)
Changed 8 years ago by
Attachment: | loading.html added |
---|
Changed 8 years ago by
Attachment: | inner_loading.html added |
---|
Page loaded by the dojox.layout.ContentPane?
comment:1 Changed 8 years ago by
The current workaround I am using is to change the dojo.js from line 1631 to:
if(has("dojo-inject-api")){ // if the loader is on the page, there must be at least one script element // getting its parent and then doing insertBefore solves the "Operation Aborted" // error in IE from appending to a node that isn't properly closed; see // dojo/tests/_base/loader/requirejs/simple-badbase.html for an example // XANG: added to enable require inside of dojox.layout.ContentPane when first <script> tag is a dojo/method or dojo/connect var scripts = doc.getElementsByTagName("script"); var sibling, insertPoint; for(var i in scripts) { if(scripts[i]['type'] != "dojo/connect" && scripts[i]['type'] != "dojo/method") { sibling = scripts[i]; break; } } if(sibling) { insertPoint = sibling.parentNode; } // XANG: end patch //var sibling = doc.getElementsByTagName("script")[0], //insertPoint= sibling.parentNode; req.injectUrl = function(url, callback, owner){
NOTE: this is only my workaround, please feel free to adjust/improve upon it.
comment:2 Changed 8 years ago by
One last thought, this issue could be workaround if an empty script tag is embedded before any script tag for dojo/connect or dojo/method.
Main Page