Title: [223306] trunk
Revision
223306
Author
cdu...@apple.com
Date
2017-10-13 15:36:28 -0700 (Fri, 13 Oct 2017)

Log Message

DOMTokenList shouldn't add empty attributes
https://bugs.webkit.org/show_bug.cgi?id=178280

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline web-platform-test now that all checks are passing.

* web-platform-tests/dom/nodes/Element-classlist-expected.txt:

Source/WebCore:

DOMTokenList shouldn't add empty attributes after:
- https://github.com/whatwg/dom/pull/488

Firefox and Chrome follow the latest spec.

No new tests, updating existing test.

* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
Implement the first step of https://dom.spec.whatwg.org/#concept-dtl-update

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (223305 => 223306)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-10-13 22:26:09 UTC (rev 223305)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-10-13 22:36:28 UTC (rev 223306)
@@ -1,3 +1,14 @@
+2017-10-13  Chris Dumez  <cdu...@apple.com>
+
+        DOMTokenList shouldn't add empty attributes
+        https://bugs.webkit.org/show_bug.cgi?id=178280
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline web-platform-test now that all checks are passing.
+
+        * web-platform-tests/dom/nodes/Element-classlist-expected.txt:
+
 2017-10-13  Romain Bellessort  <romain.belless...@crf.canon.fr>
 
         [Readable Streams API] Align queue with spec for ReadableStreamDefaultController

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt (223305 => 223306)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt	2017-10-13 22:26:09 UTC (rev 223305)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt	2017-10-13 22:36:28 UTC (rev 223306)
@@ -153,7 +153,7 @@
 PASS classList.toggle("a ", false) with attribute value "a " (HTML node) 
 PASS classList.remove("aa ") with attribute value "aa " (HTML node) 
 PASS classList.toggle("aa ", false) with attribute value "aa " (HTML node) 
-FAIL classList.remove("a") with attribute value null (HTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a") with attribute value null (HTML node) 
 PASS classList.toggle("a", false) with attribute value null (HTML node) 
 PASS classList.remove("a") with attribute value "" (HTML node) 
 PASS classList.toggle("a", false) with attribute value "" (HTML node) 
@@ -201,7 +201,7 @@
 PASS classList.remove("a", "a") with attribute value "a b c " (HTML node) 
 PASS classList.remove("d", "d") with attribute value "a b c " (HTML node) 
 PASS classList.remove() with attribute value "a b c " (HTML node) 
-FAIL classList.remove("a", "b") with attribute value null (HTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a", "b") with attribute value null (HTML node) 
 PASS classList.remove("a", "b") with attribute value "" (HTML node) 
 PASS classList.remove() with attribute value "a a" (HTML node) 
 PASS classList.remove(null) with attribute value "null" (HTML node) 
@@ -436,7 +436,7 @@
 PASS classList.toggle("a ", false) with attribute value "a " (XHTML node) 
 PASS classList.remove("aa ") with attribute value "aa " (XHTML node) 
 PASS classList.toggle("aa ", false) with attribute value "aa " (XHTML node) 
-FAIL classList.remove("a") with attribute value null (XHTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a") with attribute value null (XHTML node) 
 PASS classList.toggle("a", false) with attribute value null (XHTML node) 
 PASS classList.remove("a") with attribute value "" (XHTML node) 
 PASS classList.toggle("a", false) with attribute value "" (XHTML node) 
@@ -484,7 +484,7 @@
 PASS classList.remove("a", "a") with attribute value "a b c " (XHTML node) 
 PASS classList.remove("d", "d") with attribute value "a b c " (XHTML node) 
 PASS classList.remove() with attribute value "a b c " (XHTML node) 
-FAIL classList.remove("a", "b") with attribute value null (XHTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a", "b") with attribute value null (XHTML node) 
 PASS classList.remove("a", "b") with attribute value "" (XHTML node) 
 PASS classList.remove() with attribute value "a a" (XHTML node) 
 PASS classList.remove(null) with attribute value "null" (XHTML node) 
@@ -719,7 +719,7 @@
 PASS classList.toggle("a ", false) with attribute value "a " (MathML node) 
 PASS classList.remove("aa ") with attribute value "aa " (MathML node) 
 PASS classList.toggle("aa ", false) with attribute value "aa " (MathML node) 
-FAIL classList.remove("a") with attribute value null (MathML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a") with attribute value null (MathML node) 
 PASS classList.toggle("a", false) with attribute value null (MathML node) 
 PASS classList.remove("a") with attribute value "" (MathML node) 
 PASS classList.toggle("a", false) with attribute value "" (MathML node) 
@@ -767,7 +767,7 @@
 PASS classList.remove("a", "a") with attribute value "a b c " (MathML node) 
 PASS classList.remove("d", "d") with attribute value "a b c " (MathML node) 
 PASS classList.remove() with attribute value "a b c " (MathML node) 
-FAIL classList.remove("a", "b") with attribute value null (MathML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a", "b") with attribute value null (MathML node) 
 PASS classList.remove("a", "b") with attribute value "" (MathML node) 
 PASS classList.remove() with attribute value "a a" (MathML node) 
 PASS classList.remove(null) with attribute value "null" (MathML node) 
@@ -1002,7 +1002,7 @@
 PASS classList.toggle("a ", false) with attribute value "a " (XML node with null namespace) 
 PASS classList.remove("aa ") with attribute value "aa " (XML node with null namespace) 
 PASS classList.toggle("aa ", false) with attribute value "aa " (XML node with null namespace) 
-FAIL classList.remove("a") with attribute value null (XML node with null namespace) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a") with attribute value null (XML node with null namespace) 
 PASS classList.toggle("a", false) with attribute value null (XML node with null namespace) 
 PASS classList.remove("a") with attribute value "" (XML node with null namespace) 
 PASS classList.toggle("a", false) with attribute value "" (XML node with null namespace) 
@@ -1050,7 +1050,7 @@
 PASS classList.remove("a", "a") with attribute value "a b c " (XML node with null namespace) 
 PASS classList.remove("d", "d") with attribute value "a b c " (XML node with null namespace) 
 PASS classList.remove() with attribute value "a b c " (XML node with null namespace) 
-FAIL classList.remove("a", "b") with attribute value null (XML node with null namespace) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a", "b") with attribute value null (XML node with null namespace) 
 PASS classList.remove("a", "b") with attribute value "" (XML node with null namespace) 
 PASS classList.remove() with attribute value "a a" (XML node with null namespace) 
 PASS classList.remove(null) with attribute value "null" (XML node with null namespace) 
@@ -1285,7 +1285,7 @@
 PASS classList.toggle("a ", false) with attribute value "a " (foo node) 
 PASS classList.remove("aa ") with attribute value "aa " (foo node) 
 PASS classList.toggle("aa ", false) with attribute value "aa " (foo node) 
-FAIL classList.remove("a") with attribute value null (foo node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a") with attribute value null (foo node) 
 PASS classList.toggle("a", false) with attribute value null (foo node) 
 PASS classList.remove("a") with attribute value "" (foo node) 
 PASS classList.toggle("a", false) with attribute value "" (foo node) 
@@ -1333,7 +1333,7 @@
 PASS classList.remove("a", "a") with attribute value "a b c " (foo node) 
 PASS classList.remove("d", "d") with attribute value "a b c " (foo node) 
 PASS classList.remove() with attribute value "a b c " (foo node) 
-FAIL classList.remove("a", "b") with attribute value null (foo node) assert_equals: wrong class after modification expected (object) null but got (string) ""
+PASS classList.remove("a", "b") with attribute value null (foo node) 
 PASS classList.remove("a", "b") with attribute value "" (foo node) 
 PASS classList.remove() with attribute value "a a" (foo node) 
 PASS classList.remove(null) with attribute value "null" (foo node) 

Modified: trunk/Source/WebCore/ChangeLog (223305 => 223306)


--- trunk/Source/WebCore/ChangeLog	2017-10-13 22:26:09 UTC (rev 223305)
+++ trunk/Source/WebCore/ChangeLog	2017-10-13 22:36:28 UTC (rev 223306)
@@ -1,3 +1,21 @@
+2017-10-13  Chris Dumez  <cdu...@apple.com>
+
+        DOMTokenList shouldn't add empty attributes
+        https://bugs.webkit.org/show_bug.cgi?id=178280
+
+        Reviewed by Ryosuke Niwa.
+
+        DOMTokenList shouldn't add empty attributes after:
+        - https://github.com/whatwg/dom/pull/488
+
+        Firefox and Chrome follow the latest spec.
+
+        No new tests, updating existing test.
+
+        * html/DOMTokenList.cpp:
+        (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
+        Implement the first step of https://dom.spec.whatwg.org/#concept-dtl-update
+
 2017-10-13  Jer Noble  <jer.no...@apple.com>
 
         Unreviewed build fix; wrap more functions in USE(IOSURFACE) so that

Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (223305 => 223306)


--- trunk/Source/WebCore/html/DOMTokenList.cpp	2017-10-13 22:26:09 UTC (rev 223305)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp	2017-10-13 22:36:28 UTC (rev 223306)
@@ -248,6 +248,9 @@
 {
     ASSERT(!m_tokensNeedUpdating);
 
+    if (!m_element.hasAttribute(m_attributeName) && tokens().isEmpty())
+        return;
+
     // https://dom.spec.whatwg.org/#concept-ordered-set-serializer
     StringBuilder builder;
     for (auto& token : tokens()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to