Title: [203401] trunk
Revision
203401
Author
[email protected]
Date
2016-07-19 00:41:21 -0700 (Tue, 19 Jul 2016)

Log Message

form.enctype / encoding / method should treat null as "null" string
https://bugs.webkit.org/show_bug.cgi?id=159916

Reviewed by Ryosuke Niwa.

Source/WebCore:

form.enctype / encoding / method should treat null as "null" string:
- https://html.spec.whatwg.org/multipage/forms.html#htmlformelement

Previously, WebKit would treat null as the null String, which would
end up removing the existing attribute.

Firefox and Chrome match the specification.

Test: fast/dom/HTMLFormElement/null-handling.html

* html/HTMLFormElement.h:
* html/HTMLFormElement.idl:

LayoutTests:

Add layout test coverage.

* fast/dom/HTMLFormElement/null-handling-expected.txt: Added.
* fast/dom/HTMLFormElement/null-handling.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203400 => 203401)


--- trunk/LayoutTests/ChangeLog	2016-07-19 07:38:55 UTC (rev 203400)
+++ trunk/LayoutTests/ChangeLog	2016-07-19 07:41:21 UTC (rev 203401)
@@ -1,3 +1,15 @@
+2016-07-19  Chris Dumez  <[email protected]>
+
+        form.enctype / encoding / method should treat null as "null" string
+        https://bugs.webkit.org/show_bug.cgi?id=159916
+
+        Reviewed by Ryosuke Niwa.
+
+        Add layout test coverage.
+
+        * fast/dom/HTMLFormElement/null-handling-expected.txt: Added.
+        * fast/dom/HTMLFormElement/null-handling.html: Added.
+
 2016-07-19  Youenn Fablet  <[email protected]>
 
         Add new aliases to http test server

Added: trunk/LayoutTests/fast/dom/HTMLFormElement/null-handling-expected.txt (0 => 203401)


--- trunk/LayoutTests/fast/dom/HTMLFormElement/null-handling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLFormElement/null-handling-expected.txt	2016-07-19 07:41:21 UTC (rev 203401)
@@ -0,0 +1,20 @@
+Tests null handling of several HTMLFormElement attributes
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS form.getAttribute('method') is null
+PASS form.getAttribute('enctype') is null
+PASS form.getAttribute('encoding') is null
+form.method = null
+PASS form.getAttribute('method') is "null"
+form.enctype = null
+PASS form.getAttribute('enctype') is "null"
+form.encoding = 'test'
+PASS form.getAttribute('enctype') is "test"
+form.encoding = null
+PASS form.getAttribute('enctype') is "null"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/HTMLFormElement/null-handling.html (0 => 203401)


--- trunk/LayoutTests/fast/dom/HTMLFormElement/null-handling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLFormElement/null-handling.html	2016-07-19 07:41:21 UTC (rev 203401)
@@ -0,0 +1,23 @@
+<DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests null handling of several HTMLFormElement attributes");
+
+var form = document.createElement("form");
+shouldBeNull("form.getAttribute('method')", "");
+shouldBeNull("form.getAttribute('enctype')", "");
+shouldBeNull("form.getAttribute('encoding')", "");
+evalAndLog("form.method = null");
+shouldBeEqualToString("form.getAttribute('method')", "null");
+evalAndLog("form.enctype = null");
+shouldBeEqualToString("form.getAttribute('enctype')", "null");
+evalAndLog("form.encoding = 'test'");
+shouldBeEqualToString("form.getAttribute('enctype')", "test");
+evalAndLog("form.encoding = null");
+shouldBeEqualToString("form.getAttribute('enctype')", "null");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (203400 => 203401)


--- trunk/Source/WebCore/ChangeLog	2016-07-19 07:38:55 UTC (rev 203400)
+++ trunk/Source/WebCore/ChangeLog	2016-07-19 07:41:21 UTC (rev 203401)
@@ -1,3 +1,23 @@
+2016-07-19  Chris Dumez  <[email protected]>
+
+        form.enctype / encoding / method should treat null as "null" string
+        https://bugs.webkit.org/show_bug.cgi?id=159916
+
+        Reviewed by Ryosuke Niwa.
+
+        form.enctype / encoding / method should treat null as "null" string:
+        - https://html.spec.whatwg.org/multipage/forms.html#htmlformelement
+
+        Previously, WebKit would treat null as the null String, which would
+        end up removing the existing attribute.
+
+        Firefox and Chrome match the specification.
+
+        Test: fast/dom/HTMLFormElement/null-handling.html
+
+        * html/HTMLFormElement.h:
+        * html/HTMLFormElement.idl:
+
 2016-07-18  Csaba Osztrogonác  <[email protected]>
 
         All-in-one buildfix after r202439

Modified: trunk/Source/WebCore/html/HTMLFormElement.h (203400 => 203401)


--- trunk/Source/WebCore/html/HTMLFormElement.h	2016-07-19 07:38:55 UTC (rev 203400)
+++ trunk/Source/WebCore/html/HTMLFormElement.h	2016-07-19 07:41:21 UTC (rev 203401)
@@ -61,9 +61,6 @@
     String enctype() const { return m_attributes.encodingType(); }
     void setEnctype(const String&);
 
-    String encoding() const { return m_attributes.encodingType(); }
-    void setEncoding(const String& value) { setEnctype(value); }
-
     bool shouldAutocomplete() const;
 
     void setAutocomplete(const AtomicString&);

Modified: trunk/Source/WebCore/html/HTMLFormElement.idl (203400 => 203401)


--- trunk/Source/WebCore/html/HTMLFormElement.idl	2016-07-19 07:38:55 UTC (rev 203400)
+++ trunk/Source/WebCore/html/HTMLFormElement.idl	2016-07-19 07:41:21 UTC (rev 203401)
@@ -26,10 +26,9 @@
     [Reflect, URL] attribute DOMString action;
     attribute DOMString autocomplete;
 
-    // FIXME: These should not have [TreatNullAs=LegacyNullString].
-    [TreatNullAs=LegacyNullString] attribute DOMString enctype;
-    [TreatNullAs=LegacyNullString] attribute DOMString encoding;
-    [TreatNullAs=LegacyNullString] attribute DOMString method;
+    attribute DOMString enctype;
+    [ImplementedAs=enctype] attribute DOMString encoding;
+    attribute DOMString method;
 
     [Reflect] attribute DOMString name;
     [Reflect] attribute boolean noValidate;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to