Closed
Bug 963529
Opened 11 years ago
Closed 6 years ago
Dispatching a 'click' event immediately after removing "disabled" property on a form element doesn't work
Categories
(Core :: DOM: Events, defect, P3)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jd, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(1 file)
885 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36
Steps to reproduce:
* Create an HTML form with <input type="submit" disabled>
* In JavaScript:
* Change the property "disabled" of input to false
* Trigger a "click" event on the input
Here's a JSFiddle with the above: http://jsfiddle.net/jdudek/7XK2Q/5/
Here's my earlier fiddle that does the same with jQuery: http://jsfiddle.net/jdudek/7XK2Q/2/
Adding window.setTimeout() between change of "disabled" and triggering a click solves the problem. (Minimum of 10ms worked for me).
Actual results:
The form is not submitted. (Its event handler for "submit" is not triggered).
Expected results:
The form should be submitted. (Its event handler for "submit" should be triggered).
Comment 1•10 years ago
|
||
Confirmed on the current nightly. Chrome works as expected with this testcase.
Note that the testcase removes 'disabled' and synthesizes the event on load, so the 'submitted' text should appear when the page is loaded, not after you click the Submit button.
I've stumbled on this bug while searching for a similar bug, where removing 'disabled' from an <input type=checkbox> and immediately calling .click() on it had no effect.
This might change when bug 329509 is fixed.
Comment 2•10 years ago
|
||
Comment 4•7 years ago
|
||
Copying relevant comment from the dupe:
(In reply to Olli Pettay [:smaug] (unusual timezone [JST] for a week) from bug 1443148 comment #6)
> 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.
Updated•7 years ago
|
Priority: -- → P3
Comment 5•6 years ago
|
||
WFM as bug 329509 landed.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•