Open Bug 1045635 Opened 10 years ago Updated 2 years ago

`blur` that happens because of a mouse click is sent to the element that is inserted and focused during `mousedown` that is fired for the same click


(Core :: DOM: Events, defect, P5)

31 Branch
Windows 8.1





(Reporter: iosank, Unassigned)


User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36

Steps to reproduce:

See jsfiddle:

In the jsfiddle, click the blue div.

Actual results:

Observe: a message appears in the div below `FOCUSOUT id=2`, the `input` is not focused.

Expected results:

Expected: either no message or `FOCUSOUT id=1`, the `input` is focused.

Let me describe the problem in more detail.
What we have here is an `input` and a `div`. When we click the `div`, the following events are fired: 

1. `mousedown`
2. `blur`

Now, during `mousedown` the `input` is removed and replaced with a new one, which is focused.

The expected behaviour is for the `blur` to be sent to the old `input` (thus `FOCUSOUT id = 1` would be shown) or to be not sent, because the relevant element is not in the DOM anymore. However, Firefox sends the `blur` event to the element that is focused at the time when `blur` event is generated, which makes no sense: the element which receives the `blur` even wasn't in the DOM when the click happened!

Note that Chrome 36.0.1985.125 has the same problem. IE 11.0.9600.16659 doesn't: it doesn't send `blur` in this case.

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.