Closed Bug 1426856 Opened 8 years ago Closed 7 years ago

dispatchEvent is not working immediatly after synchronously setting disabled = false

Categories

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

57 Branch
x86
Windows 10
defect

Tracking

()

RESOLVED DUPLICATE of bug 963529

People

(Reporter: alanwaiss, Unassigned)

Details

(Whiteboard: [specification][type:bug])

Attachments

(1 file)

What did you do? ================ 1. Create a disabled text box (<input id="test" type="text" disabled="disabled" />) 2. Get a reference to the text box (var myTb = document.getElementById("test")) 3. Enabled the text box (myTB.disabled = false) 4. Initialize a new "blur" event 5. Execute dispatchEvent (myTB.dispatchEvent(event)) What happened? ============== Nothing. The event was not executed. What should have happened? ========================== The event should be executed Is there anything else we should know? ====================================== I don't know exactly what version this stopped working, but prior to Quantum, this worked as expected and does work in other browsers such as Chrome. If I set disabled = false then use setTimeout with a 1 millisecond delay to create and dispatch the event, it works as expected.
Note that the asyncTest doesn't always work if I reduce the timeout to 1 or 5 milliseconds instead of 25.
Thank you the bug report. What version of Firefox are you using?
Component: Events → Untriaged
Flags: needinfo?(alanwaiss)
OS: Other → Windows 10
Product: Mozilla Developer Network → Firefox
Hardware: All → x86
(In reply to John Whitlock [:jwhitlock] from comment #2) > Thank you the bug report. What version of Firefox are you using? 57.0.2
Flags: needinfo?(alanwaiss)
Version: unspecified → 57 Branch
Component: Untriaged → DOM: Events
Product: Firefox → Core
I managed to reproduce this issue on old versions, firefox 44 and firefox 52. This seems not a recent regression.
Do you have ideas where our code behaves this way?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(sshih)
Priority: -- → P3
Isn't this a dup... We don't flush the layout so https://searchfox.org/mozilla-central/rev/51cd1093c5c2113e7b041e8cc5c9bf2186abda13/layout/style/res/forms.css#432 still applies. https://searchfox.org/mozilla-central/rev/51cd1093c5c2113e7b041e8cc5c9bf2186abda13/dom/html/nsGenericHTMLElement.cpp#2292 I don't have good ideas how to fix this though. We don't want to flush layout all the time. Or, hmm, perhaps we could flush style when changing disabled state.
Yes, this is a dupe.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(stone123456)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: