Title: [223330] trunk/Source/WebCore
Revision
223330
Author
[email protected]
Date
2017-10-15 14:58:42 -0700 (Sun, 15 Oct 2017)

Log Message

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

Reviewed by Ryosuke Niwa.

Follow-up to r223306, reverse the check conditions to avoid attribute
lookup when possible. Also use m_tokens instead of tokens() to avoid
unnecessary branch.

* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223329 => 223330)


--- trunk/Source/WebCore/ChangeLog	2017-10-15 20:13:51 UTC (rev 223329)
+++ trunk/Source/WebCore/ChangeLog	2017-10-15 21:58:42 UTC (rev 223330)
@@ -1,3 +1,18 @@
+2017-10-15  Chris Dumez  <[email protected]>
+
+        DOMTokenList shouldn't add empty attributes
+        https://bugs.webkit.org/show_bug.cgi?id=178280
+        <rdar://problem/34987431>
+
+        Reviewed by Ryosuke Niwa.
+
+        Follow-up to r223306, reverse the check conditions to avoid attribute
+        lookup when possible. Also use m_tokens instead of tokens() to avoid
+        unnecessary branch.
+
+        * html/DOMTokenList.cpp:
+        (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
+
 2017-10-15  Darin Adler  <[email protected]>
 
         UTF-8 decoding produces one replacement character per byte; Encoding standard requires one replacement character per illegal sequence instead

Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (223329 => 223330)


--- trunk/Source/WebCore/html/DOMTokenList.cpp	2017-10-15 20:13:51 UTC (rev 223329)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp	2017-10-15 21:58:42 UTC (rev 223330)
@@ -248,7 +248,7 @@
 {
     ASSERT(!m_tokensNeedUpdating);
 
-    if (!m_element.hasAttribute(m_attributeName) && tokens().isEmpty())
+    if (m_tokens.isEmpty() && !m_element.hasAttribute(m_attributeName))
         return;
 
     // https://dom.spec.whatwg.org/#concept-ordered-set-serializer
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to