Title: [206588] trunk
Revision
206588
Author
cdu...@apple.com
Date
2016-09-29 10:41:50 -0700 (Thu, 29 Sep 2016)

Log Message

Assigning non-numeric to input.minlength should set minlength to 0
https://bugs.webkit.org/show_bug.cgi?id=162727

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import test coverage.

* web-platform-tests/html/semantics/forms/the-input-element/minlength-expected.txt: Added.
* web-platform-tests/html/semantics/forms/the-input-element/minlength.html: Added.

Source/WebCore:

There was a typo when we were updating the m_minLength member from the 'min'
content attribute instead of the 'minlength' one.

Test: imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206587 => 206588)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-09-29 17:18:35 UTC (rev 206587)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-09-29 17:41:50 UTC (rev 206588)
@@ -1,3 +1,15 @@
+2016-09-29  Chris Dumez  <cdu...@apple.com>
+
+        Assigning non-numeric to input.minlength should set minlength to 0
+        https://bugs.webkit.org/show_bug.cgi?id=162727
+
+        Reviewed by Ryosuke Niwa.
+
+        Import test coverage.
+
+        * web-platform-tests/html/semantics/forms/the-input-element/minlength-expected.txt: Added.
+        * web-platform-tests/html/semantics/forms/the-input-element/minlength.html: Added.
+
 2016-09-28  Chris Dumez  <cdu...@apple.com>
 
         Import touch-events web-platform-tests

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength-expected.txt (0 => 206588)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength-expected.txt	2016-09-29 17:41:50 UTC (rev 206588)
@@ -0,0 +1,9 @@
+Text input element
+
+
+PASS Unset minlength is -1 
+PASS Negative minlength is always -1 
+PASS Non-numeric minlength is -1 
+PASS Assigning negative integer throws IndexSizeError 
+PASS Assigning non-numeric to minlength sets minlength to 0 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html (0 => 206588)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html	2016-09-29 17:41:50 UTC (rev 206588)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>input min length</title>
+    <link rel="author" title="Taryn Hill" href=""
+    <link rel=help href=""
+    <script src=""
+    <script src=""
+  </head>
+
+  <body>
+    <h1>Text input element</h1>
+
+    <div style="display: none">
+      <input id="none" />
+      <input id="negative" minlength=-5 />
+      <input id="non-numeric" minlength="not-a-number" />
+      <input id="assign-negative" />
+      <input id="assign-non-numeric" />
+    </div>
+
+    <div id="log"></div>
+
+    <script type="text/_javascript_">
+      test(
+        function() {
+          assert_equals(document.getElementById("none").minLength, -1);
+        }, "Unset minlength is -1");
+
+      test(
+        function() {
+          assert_equals(document.getElementById("negative").minLength, -1);
+        }, "Negative minlength is always -1");
+
+      test(
+        function() {
+          assert_equals(document.getElementById("non-numeric").minLength, -1);
+        }, "Non-numeric minlength is -1");
+
+      test(
+          function() {
+            assert_throws("INDEX_SIZE_ERR", function() {
+              document.getElementById("assign-negative").minLength = -5;
+            });
+          }, "Assigning negative integer throws IndexSizeError");
+
+      test(
+          function() {
+            document.getElementById("assign-non-numeric").minLength = "not-a-number";
+            assert_equals(document.getElementById("assign-non-numeric").minLength, 0);
+          }, "Assigning non-numeric to minlength sets minlength to 0");
+    </script>
+  </body>
+</html>
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/w3c-import.log (206587 => 206588)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/w3c-import.log	2016-09-29 17:18:35 UTC (rev 206587)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/w3c-import.log	2016-09-29 17:41:50 UTC (rev 206588)
@@ -32,6 +32,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-button.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-checkbox.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/maxlength.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/month.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/number.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/password.html

Modified: trunk/Source/WebCore/ChangeLog (206587 => 206588)


--- trunk/Source/WebCore/ChangeLog	2016-09-29 17:18:35 UTC (rev 206587)
+++ trunk/Source/WebCore/ChangeLog	2016-09-29 17:41:50 UTC (rev 206588)
@@ -1,5 +1,20 @@
 2016-09-29  Chris Dumez  <cdu...@apple.com>
 
+        Assigning non-numeric to input.minlength should set minlength to 0
+        https://bugs.webkit.org/show_bug.cgi?id=162727
+
+        Reviewed by Ryosuke Niwa.
+
+        There was a typo when we were updating the m_minLength member from the 'min'
+        content attribute instead of the 'minlength' one.
+
+        Test: imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::parseAttribute):
+
+2016-09-29  Chris Dumez  <cdu...@apple.com>
+
         [Web IDL] Fix overload resolution when the distinguishing argument is a Window
         https://bugs.webkit.org/show_bug.cgi?id=162728
 

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (206587 => 206588)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-09-29 17:18:35 UTC (rev 206587)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-09-29 17:41:50 UTC (rev 206588)
@@ -714,7 +714,7 @@
         }
     } else if (name == maxlengthAttr)
         maxLengthAttributeChanged(value);
-    else if (name == minAttr)
+    else if (name == minlengthAttr)
         minLengthAttributeChanged(value);
     else if (name == sizeAttr) {
         unsigned oldSize = m_size;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to