Title: [197497] trunk
- Revision
- 197497
- Author
- [email protected]
- Date
- 2016-03-02 23:44:00 -0800 (Wed, 02 Mar 2016)
Log Message
HTMLFormElement's named property getter does not return a RadioNodelist
https://bugs.webkit.org/show_bug.cgi?id=154949
Reviewed by Ryosuke Niwa.
Source/WebCore:
HTMLFormElement's named property getter should return a RadioNodeList
when there are several matches:
https://html.spec.whatwg.org/multipage/forms.html#the-form-element
Previously, WebKit returned a generic NodeList. As a result, users
cannot create a white-and-gold hat in the MAKE A HAT GREAT AGAIN
section at:
https://www.washingtonpost.com/news/the-fix/wp/2015/10/06/hey-lets-all-make-our-own-donald-trump-hats/
Chrome and Firefox already match the specification. Edge will soon.
Test: fast/dom/HTMLFormElement/named-property-getter-radionodelist.html
* bindings/js/JSHTMLFormElementCustom.cpp:
(WebCore::JSHTMLFormElement::nameGetter):
LayoutTests:
Add layout test to confirm that HTMLFormElement's named property getter
does indeed return a RadioNodeList when there are several matches.
* fast/dom/HTMLFormElement/named-property-getter-radionodelist-expected.txt: Added.
* fast/dom/HTMLFormElement/named-property-getter-radionodelist.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (197496 => 197497)
--- trunk/LayoutTests/ChangeLog 2016-03-03 07:36:17 UTC (rev 197496)
+++ trunk/LayoutTests/ChangeLog 2016-03-03 07:44:00 UTC (rev 197497)
@@ -1,5 +1,18 @@
2016-03-02 Chris Dumez <[email protected]>
+ HTMLFormElement's named property getter does not return a RadioNodelist
+ https://bugs.webkit.org/show_bug.cgi?id=154949
+
+ Reviewed by Ryosuke Niwa.
+
+ Add layout test to confirm that HTMLFormElement's named property getter
+ does indeed return a RadioNodeList when there are several matches.
+
+ * fast/dom/HTMLFormElement/named-property-getter-radionodelist-expected.txt: Added.
+ * fast/dom/HTMLFormElement/named-property-getter-radionodelist.html: Added.
+
+2016-03-02 Chris Dumez <[email protected]>
+
Drop [TreatNullAs=LegacyNullString] from HTMLBaseElement.href
https://bugs.webkit.org/show_bug.cgi?id=154952
Added: trunk/LayoutTests/fast/dom/HTMLFormElement/named-property-getter-radionodelist-expected.txt (0 => 197497)
--- trunk/LayoutTests/fast/dom/HTMLFormElement/named-property-getter-radionodelist-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLFormElement/named-property-getter-radionodelist-expected.txt 2016-03-03 07:44:00 UTC (rev 197497)
@@ -0,0 +1,15 @@
+Tests that HTMLFormElement's named property getter returns a RadioNodeList if there are several matching elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS radioNodeList.__proto__ is RadioNodeList.prototype
+PASS radioNodeList.length is 3
+PASS radioNodeList[0] is radio1
+PASS radioNodeList[1] is radio2
+PASS radioNodeList[2] is radio3
+PASS radioNodeList.value is "value2"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/HTMLFormElement/named-property-getter-radionodelist.html (0 => 197497)
--- trunk/LayoutTests/fast/dom/HTMLFormElement/named-property-getter-radionodelist.html (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLFormElement/named-property-getter-radionodelist.html 2016-03-03 07:44:00 UTC (rev 197497)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<form name="f">
+ <input type="radio" id="radio1" name="r" value="value1" />
+ <input type="radio" id="radio2" name="r" value="value2" checked />
+ <input type="radio" id="radio3" name="r" value="value3" />
+</form>
+<script>
+description("Tests that HTMLFormElement's named property getter returns a RadioNodeList if there are several matching elements.");
+
+var radio1 = document.getElementById("radio1");
+var radio2 = document.getElementById("radio2");
+var radio3 = document.getElementById("radio3");
+
+var radioNodeList = document.f.r;
+shouldBe("radioNodeList.__proto__", "RadioNodeList.prototype");
+shouldBe("radioNodeList.length", "3");
+shouldBe("radioNodeList[0]", "radio1");
+shouldBe("radioNodeList[1]", "radio2");
+shouldBe("radioNodeList[2]", "radio3");
+shouldBeEqualToString("radioNodeList.value", "value2");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (197496 => 197497)
--- trunk/Source/WebCore/ChangeLog 2016-03-03 07:36:17 UTC (rev 197496)
+++ trunk/Source/WebCore/ChangeLog 2016-03-03 07:44:00 UTC (rev 197497)
@@ -1,5 +1,28 @@
2016-03-02 Chris Dumez <[email protected]>
+ HTMLFormElement's named property getter does not return a RadioNodelist
+ https://bugs.webkit.org/show_bug.cgi?id=154949
+
+ Reviewed by Ryosuke Niwa.
+
+ HTMLFormElement's named property getter should return a RadioNodeList
+ when there are several matches:
+ https://html.spec.whatwg.org/multipage/forms.html#the-form-element
+
+ Previously, WebKit returned a generic NodeList. As a result, users
+ cannot create a white-and-gold hat in the MAKE A HAT GREAT AGAIN
+ section at:
+ https://www.washingtonpost.com/news/the-fix/wp/2015/10/06/hey-lets-all-make-our-own-donald-trump-hats/
+
+ Chrome and Firefox already match the specification. Edge will soon.
+
+ Test: fast/dom/HTMLFormElement/named-property-getter-radionodelist.html
+
+ * bindings/js/JSHTMLFormElementCustom.cpp:
+ (WebCore::JSHTMLFormElement::nameGetter):
+
+2016-03-02 Chris Dumez <[email protected]>
+
Drop [TreatNullAs=LegacyNullString] from HTMLBaseElement.href
https://bugs.webkit.org/show_bug.cgi?id=154952
Modified: trunk/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp (197496 => 197497)
--- trunk/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp 2016-03-03 07:36:17 UTC (rev 197496)
+++ trunk/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp 2016-03-03 07:44:00 UTC (rev 197497)
@@ -30,8 +30,7 @@
#include "HTMLCollection.h"
#include "HTMLFormElement.h"
#include "JSDOMWindowCustom.h"
-#include "JSNodeList.h"
-#include "StaticNodeList.h"
+#include "JSRadioNodeList.h"
using namespace JSC;
@@ -48,8 +47,7 @@
return true;
}
- // FIXME: HTML5 specifies that this should be a RadioNodeList.
- value = toJS(exec, globalObject(), StaticElementList::adopt(namedItems).get());
+ value = toJS(exec, globalObject(), wrapped().radioNodeList(propertyNameToAtomicString(propertyName)).get());
return true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes