Summary: | Select validation does not correctly work when handling change event | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | mh35jp | ||||||
Component: | Forms | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | ahmad.saleem792, simon.fraser, wenson_hsieh | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Created attachment 259434 [details]
Patch
Comment on attachment 259434 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259434&action=review > Source/WebCore/ChangeLog:14 > + Test: fast/forms/onchange-select-check-validity.html > + > + When selecting an option in a <select> with validation that also has an onchange listener, calling > + checkValidity() for the select within the onchange handler would produce incorrect results and (on > + a debug build) crash at an assertion. This is because the change events were being dispatched before > + form validity was updated. Making the validation step come before the change event dispatch fixes > + this issue. Normally the Test line comes last. > LayoutTests/fast/forms/onchange-select-check-validity.html:17 > + select.onchange = showFormValidity; > + select.addEventListener("change", showFormValidity); I think these two lines do the same thing. You only need one of them. Comment on attachment 259434 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=259434&action=review >> Source/WebCore/ChangeLog:14 >> + this issue. > > Normally the Test line comes last. got it. >> LayoutTests/fast/forms/onchange-select-check-validity.html:17 >> + select.addEventListener("change", showFormValidity); > > I think these two lines do the same thing. You only need one of them. good catch. fixed! Landed and didn't backed out - https://github.com/WebKit/WebKit/commit/dfc4f77e61d39a165b4d9c8edd877282bde90e84 Marking this as "RESOLVED FIXED". |
Created attachment 254703 [details] Test case Expected behavior Select a value->1 ... Should be changed to true, but remains false 1->Select a value ... Should be changed to false, but true