Opened 9 years ago

Last modified 9 years ago

#15876 closed defect

_loadTest.js gets exception after alternate AMD loader support (IE8) — at Version 3

Reported by: bill Owned by: Douglas Hays
Priority: undecided Milestone: 1.8.1
Component: Dijit Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

After my changes in #15616, Tooltip_quirks_mouse.html is hanging on IE8, when loading ../quirks.html?file=test_Tooltip.html. Problem can be reproduced by loading that URL directly too.

The problem is in the script related code:

for(var i=0; i <scripts.length; i++){
	var script = scripts[i];
	if(!script['_oldGetAttribute']){
		var src = script.getAttribute('_oldsrc');
		if(src){
			script._oldGetAttribute = script.getAttribute;
			script.getAttribute = function(attr){ if(/^src$/i.test(attr))attr='_oldsrc';return script._oldGetAttribute(attr) };
		}
	}
}

which is likely running while the AMD loader is inserting <script> tags to load new modules. It gets an exception about _oldGetAttribute.

Change History (4)

comment:1 Changed 9 years ago by bill

Owner: changed from bill to Douglas Hays
Status: newassigned
Summary: _loadTest.js broken after AMD loader support_loadTest.js broken after alternate AMD loader support

comment:2 Changed 9 years ago by bill

Description: modified (diff)
Summary: _loadTest.js broken after alternate AMD loader support_loadTest.js broken after alternate AMD loader support (IE8)

comment:3 Changed 9 years ago by bill

Description: modified (diff)
Milestone: tbd1.8.1
Summary: _loadTest.js broken after alternate AMD loader support (IE8)_loadTest.js gets exception after alternate AMD loader support (IE8)

That loop is incorrect because the closure is referencing the variable "script", but then you change the value of script afterwards. In other words, getAttribute() for any script will try to call _oldGetAttribute() on the last script in the file.

Having said that though, I will let you update it because I don't understand why that code to override getAttribute() is there in the first place, and it might no longer make sense with AMD (which dynamically injects script tags).

Last edited 9 years ago by bill (previous) (diff)

Changed 9 years ago by Douglas Hays

Attachment: 15876.patch added
Note: See TracTickets for help on using tickets.