Closed Bug 568364 Opened 14 years ago Closed 14 years ago

dispatchEvent of type change on an input breaks subsequent event.which

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: alex, Unassigned)

References

()

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.4; .NET CLR 2.0.50727; .NET CLR 1.1.4322; MS-RTC LM 8; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; MAXTHON 2.0)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

On Safari and Firefox (2.x and 3.x), dispatching the change event
makes event.which undefined on any subsequent keyup events on ANY element!

Reproducible: Always

Steps to Reproduce:
1.Type some characters into either text field at the above url
2.You'll see their codes listed below
3.Push the Dispatch Change event button
4.Type into either text field again - this time you'll see undefined
Actual Results:  
undefined

Expected Results:  
e.which should not break after dispatching a change event

Works correctly in IE (at least 7 and 8)
This is a bug in the page.  In particular, showCode() has:

  var e = window.event || arguments.callee.caller.arguments[0];

But am_fireEvent has this code in the !document.createEventObject branch:

  event = document.createEvent('HTMLEvents');

Note lack of |var|.  So this is assigning the global "event" variable, which is the same thing as "window.event".  After that, showCode always seems the event created by am_fireEvent as window.event, and that of course has no .which property.

This "works correctly" in IE because IE itself will set window.event and also because the IE branch in am_fireEvent actually has |var event|.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.