RESOLVED FIXED 159925
Fix null handling of HTMLSelectElement.value attribute
https://bugs.webkit.org/show_bug.cgi?id=159925
Summary Fix null handling of HTMLSelectElement.value attribute
Chris Dumez
Reported 2016-07-19 10:29:47 PDT
Fix null handling of HTMLSelectElement.value attribute: https://html.spec.whatwg.org/multipage/forms.html#htmlselectelement We currently treat null as the null String which ends up setting selectedIndex to -1. However, we should treat null as the String "null" which would set the selectedIndex to the Index of the <option> element whose value is "null". Firefox and Chrome match the specification.
Attachments
Patch (5.22 KB, patch)
2016-07-19 10:32 PDT, Chris Dumez
benjamin: review+
Chris Dumez
Comment 1 2016-07-19 10:32:35 PDT
Benjamin Poulain
Comment 2 2016-07-19 21:46:51 PDT
Comment on attachment 284019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284019&action=review > LayoutTests/fast/dom/HTMLSelectElement/value-null-handling.html:19 > +evalAndLog("select.value = null"); > +shouldBeEqualToString("select.value", "null"); > +shouldBe("select.selectedIndex", "1"); You are missing a case. Setting the value to null and not having a value==="null" in the select element.
Chris Dumez
Comment 3 2016-07-20 09:38:39 PDT
Chris Dumez
Comment 4 2016-07-20 10:42:44 PDT
(In reply to comment #2) > Comment on attachment 284019 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=284019&action=review > > > LayoutTests/fast/dom/HTMLSelectElement/value-null-handling.html:19 > > +evalAndLog("select.value = null"); > > +shouldBeEqualToString("select.value", "null"); > > +shouldBe("select.selectedIndex", "1"); > > You are missing a case. Setting the value to null and not having a > value==="null" in the select element. I added it before landing, thanks.
Note You need to log in before you can comment on or make changes to this bug.