Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2556 closed defect (fixed)

event.stopEvent method causes error on IE when using frames

Reported by: guest Owned by: alex
Priority: high Milestone: 0.9
Component: Events Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:

Description

When the event originates from a different window then window.event is null and therefor in

if(window.event){
   evt.cancelBubble = true;
   evt.returnValue = false;
}else{
   evt.preventDefault();
   evt.stopPropagation();
}

the else block is executed which yields a "Object doesn't support this property or method" error.

I think the "if" clause should be changed to

   if(typeof(window.event) == "undefined"){
   ... 

Change History (6)

comment:1 Changed 12 years ago by bill

Milestone: 0.9
Resolution: fixed
Status: newclosed

In 0.9 this code has been changed to:

	dojo.stopEvent = function(/*Event*/evt){
		// summary:
		//		prevents propagation and clobbers the default action of the
		//		passed event
		// evt: Optional for IE. The native event object.
		evt.preventDefault();
		evt.stopPropagation();
	}

Looks fixed. The comment is obviously wrong though so I'll fix that.

comment:2 Changed 12 years ago by bill

(In [9823]) Fix comments (evt is obviously not optional). Refs #2556.

comment:3 Changed 12 years ago by sjmiles

Resolution: fixed
Status: closedreopened

Farther down in the file we have:

365		// override stopEvent for IE
366		dojo.stopEvent = function(evt){
367		evt = evt || window.event;

So the documentation was actually correct, although (afaik) it's an open question how the documentation engine handles such overrides.

comment:4 Changed 12 years ago by sjmiles

(In [9828]) Comments hopefully clarified, refs #2556.

comment:5 Changed 12 years ago by sjmiles

Resolution: fixed
Status: reopenedclosed

comment:6 Changed 12 years ago by Adam Peller

(In [9829]) Minor style, spelling changes. Refs #2556

Note: See TracTickets for help on using tickets.