Opened 9 years ago

Closed 7 years ago

#11448 closed defect (fixed)

"Type mismatch" error when loading dojo 1.4 in IE 6

Reported by: sk8mini Owned by:
Priority: high Milestone: 1.4.3
Component: Loader Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

Go to dojotoolkit.org using IE 6.0.3790.3959 (64-bit)

A dialog opens with the error

Line: 16 Error: Type mismatch

I tracked it down to this to line 1619 dojo.js.uncompressed.js

var _handleNodeEvent = function(/*String*/evtName, /*Function*/fp){

summary: non-destructively adds the specified function to the node's evtName handler. evtName: should be in the form "onclick" for "onclick" handlers. Make sure you pass in the "on" part.

var _a = _w.attachEvent
_w.addEventListener;

evtName = _w.attachEvent ? evtName : evtName.substring(2); _a(evtName, function(){

fp.apply(_w, arguments);

}, false);

};

It seems this version of IE fails when calling window.attachEvent with three arguments. The references to attachEvent I've found say that it only takes two arguments because it always bubbles. I rewrote the function to make two different calls based on which function (attachEvent or addEventListener) it was calling and the error went away, allowing the rest of dojo to correctly load.

This is affecting my own application, but the test case of dojotoolkit.org seemed particularly convenient to me.

Change History (3)

comment:1 Changed 9 years ago by sk8mini

Sorry, that code didn't come through clearly. Here it is wrapped in a block

		var _handleNodeEvent = function(/*String*/evtName, /*Function*/fp){
			// summary:
			//		non-destructively adds the specified function to the node's
			//		evtName handler.
			// evtName: should be in the form "onclick" for "onclick" handlers.
			// Make sure you pass in the "on" part.
			var _a = _w.attachEvent || _w.addEventListener;
			evtName = _w.attachEvent ? evtName : evtName.substring(2);
			_a(evtName, function(){
				fp.apply(_w, arguments);
			}, false);
		};

comment:2 Changed 9 years ago by Chris Mitchell

Owner: anonymous deleted

comment:3 Changed 7 years ago by bill

Component: GeneralLoader
Milestone: tbd1.4.3
Resolution: fixed
Status: newclosed

Looks like this was fixed in [19946], and since 1.7 the _handleNodeEvent code which was in hostenv_browser.js is gone completely.

Note: See TracTickets for help on using tickets.