Changeset 223306 in webkit


Ignore:
Timestamp:
Oct 13, 2017 3:36:28 PM (7 years ago)
Author:
Chris Dumez
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:

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

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r223279 r223306  
     12017-10-13  Chris Dumez  <cdumez@apple.com>
     2
     3        DOMTokenList shouldn't add empty attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=178280
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Rebaseline web-platform-test now that all checks are passing.
     9
     10        * web-platform-tests/dom/nodes/Element-classlist-expected.txt:
     11
    1122017-10-13  Romain Bellessort  <romain.bellessort@crf.canon.fr>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt

    r220772 r223306  
    154154PASS classList.remove("aa ") with attribute value "aa " (HTML node)
    155155PASS classList.toggle("aa ", false) with attribute value "aa " (HTML node)
    156 FAIL classList.remove("a") with attribute value null (HTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     156PASS classList.remove("a") with attribute value null (HTML node)
    157157PASS classList.toggle("a", false) with attribute value null (HTML node)
    158158PASS classList.remove("a") with attribute value "" (HTML node)
     
    202202PASS classList.remove("d", "d") with attribute value "a b c " (HTML node)
    203203PASS classList.remove() with attribute value "a b c " (HTML node)
    204 FAIL classList.remove("a", "b") with attribute value null (HTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     204PASS classList.remove("a", "b") with attribute value null (HTML node)
    205205PASS classList.remove("a", "b") with attribute value "" (HTML node)
    206206PASS classList.remove() with attribute value "a a" (HTML node)
     
    437437PASS classList.remove("aa ") with attribute value "aa " (XHTML node)
    438438PASS classList.toggle("aa ", false) with attribute value "aa " (XHTML node)
    439 FAIL classList.remove("a") with attribute value null (XHTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     439PASS classList.remove("a") with attribute value null (XHTML node)
    440440PASS classList.toggle("a", false) with attribute value null (XHTML node)
    441441PASS classList.remove("a") with attribute value "" (XHTML node)
     
    485485PASS classList.remove("d", "d") with attribute value "a b c " (XHTML node)
    486486PASS classList.remove() with attribute value "a b c " (XHTML node)
    487 FAIL classList.remove("a", "b") with attribute value null (XHTML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     487PASS classList.remove("a", "b") with attribute value null (XHTML node)
    488488PASS classList.remove("a", "b") with attribute value "" (XHTML node)
    489489PASS classList.remove() with attribute value "a a" (XHTML node)
     
    720720PASS classList.remove("aa ") with attribute value "aa " (MathML node)
    721721PASS classList.toggle("aa ", false) with attribute value "aa " (MathML node)
    722 FAIL classList.remove("a") with attribute value null (MathML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     722PASS classList.remove("a") with attribute value null (MathML node)
    723723PASS classList.toggle("a", false) with attribute value null (MathML node)
    724724PASS classList.remove("a") with attribute value "" (MathML node)
     
    768768PASS classList.remove("d", "d") with attribute value "a b c " (MathML node)
    769769PASS classList.remove() with attribute value "a b c " (MathML node)
    770 FAIL classList.remove("a", "b") with attribute value null (MathML node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     770PASS classList.remove("a", "b") with attribute value null (MathML node)
    771771PASS classList.remove("a", "b") with attribute value "" (MathML node)
    772772PASS classList.remove() with attribute value "a a" (MathML node)
     
    10031003PASS classList.remove("aa ") with attribute value "aa " (XML node with null namespace)
    10041004PASS classList.toggle("aa ", false) with attribute value "aa " (XML node with null namespace)
    1005 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) ""
     1005PASS classList.remove("a") with attribute value null (XML node with null namespace)
    10061006PASS classList.toggle("a", false) with attribute value null (XML node with null namespace)
    10071007PASS classList.remove("a") with attribute value "" (XML node with null namespace)
     
    10511051PASS classList.remove("d", "d") with attribute value "a b c " (XML node with null namespace)
    10521052PASS classList.remove() with attribute value "a b c " (XML node with null namespace)
    1053 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) ""
     1053PASS classList.remove("a", "b") with attribute value null (XML node with null namespace)
    10541054PASS classList.remove("a", "b") with attribute value "" (XML node with null namespace)
    10551055PASS classList.remove() with attribute value "a a" (XML node with null namespace)
     
    12861286PASS classList.remove("aa ") with attribute value "aa " (foo node)
    12871287PASS classList.toggle("aa ", false) with attribute value "aa " (foo node)
    1288 FAIL classList.remove("a") with attribute value null (foo node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     1288PASS classList.remove("a") with attribute value null (foo node)
    12891289PASS classList.toggle("a", false) with attribute value null (foo node)
    12901290PASS classList.remove("a") with attribute value "" (foo node)
     
    13341334PASS classList.remove("d", "d") with attribute value "a b c " (foo node)
    13351335PASS classList.remove() with attribute value "a b c " (foo node)
    1336 FAIL classList.remove("a", "b") with attribute value null (foo node) assert_equals: wrong class after modification expected (object) null but got (string) ""
     1336PASS classList.remove("a", "b") with attribute value null (foo node)
    13371337PASS classList.remove("a", "b") with attribute value "" (foo node)
    13381338PASS classList.remove() with attribute value "a a" (foo node)
  • trunk/Source/WebCore/ChangeLog

    r223298 r223306  
     12017-10-13  Chris Dumez  <cdumez@apple.com>
     2
     3        DOMTokenList shouldn't add empty attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=178280
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        DOMTokenList shouldn't add empty attributes after:
     9        - https://github.com/whatwg/dom/pull/488
     10
     11        Firefox and Chrome follow the latest spec.
     12
     13        No new tests, updating existing test.
     14
     15        * html/DOMTokenList.cpp:
     16        (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
     17        Implement the first step of https://dom.spec.whatwg.org/#concept-dtl-update
     18
    1192017-10-13  Jer Noble  <jer.noble@apple.com>
    220
  • trunk/Source/WebCore/html/DOMTokenList.cpp

    r222613 r223306  
    249249    ASSERT(!m_tokensNeedUpdating);
    250250
     251    if (!m_element.hasAttribute(m_attributeName) && tokens().isEmpty())
     252        return;
     253
    251254    // https://dom.spec.whatwg.org/#concept-ordered-set-serializer
    252255    StringBuilder builder;
Note: See TracChangeset for help on using the changeset viewer.