Closed
Bug 862587
Opened 11 years ago
Closed 11 years ago
Click events fire from removed elements and specify document as target
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 858459
People
(Reporter: uie.orionhealth, Unassigned)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0 Build ID: 20130409194949 Steps to reproduce: Wrote an HTML page with a div element, containing a select element with child option elements and wrote the following logic in JavaScript: * Attached a change event listener to the select element. The listener removes that select element from the div element on change. * Also attached a click event listener to the document. The click listener checks the target of the click event to verify it was not fired from the div element or any of its child elements (in order to implement a click "outside" listener to hide the div). Then performed the following on the rendered page: * Clicked the select element to open the options dropdown * Clicked an option that was not selected to change the selection Actual results: The select element was correctly removed but the document click listener was called with an event with the target set to the document. In my logic, this triggered the div element to hide since the click event appeared to have come from outside the div even though it didn't. Expected results: The document click event listener should not have been called, since click events should not bubble up to the document from elements that have been removed from the DOM. This is the behaviour that has happened since before Firefox 20, and is the behaviour in all other browsers I have tested. Alternatively, if the click event was fired while the element was still in the DOM, then the target should have been the option element, which should still have been in the div.
Reporter | ||
Comment 1•11 years ago
|
||
Note this also happens on Mac OS X
Updated•11 years ago
|
Attachment #738240 -
Attachment mime type: text/plain → text/html
This is probably a duplicate of bug 858459.
Reporter | ||
Comment 3•11 years ago
|
||
Yes, bug 858459 is exactly the problem we are facing.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•