Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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)

loading.html (1.6 KB) - added by xangxiong 7 years ago.
Main Page
inner_loading.html (235 bytes) - added by xangxiong 7 years ago.
Page loaded by the dojox.layout.ContentPane?

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by xangxiong

Attachment: loading.html added

Main Page

Changed 7 years ago by xangxiong

Attachment: inner_loading.html added

Page loaded by the dojox.layout.ContentPane?

comment:1 Changed 7 years ago by xangxiong

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.

Last edited 7 years ago by xangxiong (previous) (diff)

comment:2 Changed 7 years ago by xangxiong

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.

comment:3 Changed 7 years ago by bill

Resolution: duplicate
Status: newclosed

Duplicate of #15809.

comment:4 Changed 7 years ago by xangxiong

Thanks Bill, I did not see that other ticket.

Note: See TracTickets for help on using tickets.