⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243691 in webkit


Ignore:
Timestamp:
Apr 1, 2019, 5:50:44 AM (7 years ago)
Author:
emilio
Message:

Be less strict about closing blocks in attribute and functional pseudo-element selectors.
https://bugs.webkit.org/show_bug.cgi?id=142167

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

  • web-platform-tests/dom/nodes/selectors.js: Add tests for ::slotted

Source/WebCore:

This was also an issue for, e.g., "::slotted(foo", turns out.

This matches Chromium, Firefox, and the spec:

https://drafts.csswg.org/css-syntax/#parse-error:

Certain points in the parsing algorithm are said to be parse errors. The error
handling for parse errors is well-defined: user agents must either act as
described below when encountering such problems, or must abort processing at
the first error that they encounter for which they do not wish to apply the
rules described below.

https://drafts.csswg.org/css-syntax/#consume-simple-block:

<EOF-token>

This is a parse error. Return the block.

Tests: web-platform-tests/dom/nodes/selectors.js (and probably others)

  • css/parser/CSSSelectorParser.cpp:

(WebCore::CSSSelectorParser::consumeAttribute):
(WebCore::CSSSelectorParser::consumePseudo):

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3-expected.txt

    r219663 r243691  
    789789PASS document.getElementById('style-container').sheet.cssRules.length is 0
    790790PASS document.getElementById('style-container').sheet.cssRules.length is 0
    791 PASS document.querySelector("[foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    792 PASS document.querySelector("[|foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    793 PASS document.querySelector("[*|foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    794 PASS document.querySelector("[WebKit|foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    795 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    796 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    797 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    798 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    799 PASS document.querySelector("[foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    800 PASS document.querySelector("[|foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    801 PASS document.querySelector("[*|foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    802 PASS document.querySelector("[WebKit|foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    803 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    804 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    805 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    806 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    807 PASS document.querySelector("[foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    808 PASS document.querySelector("[|foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    809 PASS document.querySelector("[*|foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    810 PASS document.querySelector("[WebKit|foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    811 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    812 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    813 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    814 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    815 PASS document.querySelector("[foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    816 PASS document.querySelector("[|foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    817 PASS document.querySelector("[*|foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    818 PASS document.querySelector("[WebKit|foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    819 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    820 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    821 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    822 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    823 PASS document.querySelector("[foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    824 PASS document.querySelector("[|foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    825 PASS document.querySelector("[*|foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    826 PASS document.querySelector("[WebKit|foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    827 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    828 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    829 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    830 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    831 PASS document.querySelector("[foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    832 PASS document.querySelector("[|foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    833 PASS document.querySelector("[*|foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    834 PASS document.querySelector("[WebKit|foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    835 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    836 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    837 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    838 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    839 PASS document.querySelector("[foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    840 PASS document.querySelector("[|foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    841 PASS document.querySelector("[*|foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    842 PASS document.querySelector("[WebKit|foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    843 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    844 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    845 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    846 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    847 PASS document.querySelector("[foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    848 PASS document.querySelector("[|foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    849 PASS document.querySelector("[*|foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    850 PASS document.querySelector("[WebKit|foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    851 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    852 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    853 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    854 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    855 PASS document.querySelector("[foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    856 PASS document.querySelector("[|foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    857 PASS document.querySelector("[*|foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    858 PASS document.querySelector("[WebKit|foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    859 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    860 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    861 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    862 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    863 PASS document.querySelector("[foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    864 PASS document.querySelector("[|foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    865 PASS document.querySelector("[*|foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    866 PASS document.querySelector("[WebKit|foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    867 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    868 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    869 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    870 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    871 PASS document.querySelector("[foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    872 PASS document.querySelector("[|foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    873 PASS document.querySelector("[*|foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    874 PASS document.querySelector("[WebKit|foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
    875 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    876 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    877 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    878 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    879 PASS document.querySelector("[foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    880 PASS document.querySelector("[|foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    881 PASS document.querySelector("[*|foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    882 PASS document.querySelector("[WebKit|foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
    883 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    884 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    885 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    886 PASS document.getElementById('style-container').sheet.cssRules.length is 0
    887791PASS successfullyParsed is true
    888792
  • trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3.html

    r219663 r243691  
    144144    '[foo*=bar l]',
    145145    '[foo*="bar" l]',
    146 
    147     // Missing the closing ']'.
    148     '[foo=bar i',
    149     '[foo="bar" i',
    150     '[foo~=bar i',
    151     '[foo~="bar" i',
    152     '[foo|=bar i',
    153     '[foo|="bar" i',
    154     '[foo^=bar i',
    155     '[foo^="bar" i',
    156     '[foo$=bar i',
    157     '[foo$="bar" i',
    158     '[foo*=bar i',
    159     '[foo*="bar" i',
    160146];
    161147
  • trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt

    r219663 r243691  
    1616PASS document.querySelectorAll(":-webkit-any\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    1717PASS document.querySelectorAll(":-webkit-any\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    18 PASS document.querySelectorAll(":-webkit-any\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    1918PASS document.querySelectorAll(":-webkit-any\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    2019PASS document.querySelectorAll(":-webkit-any\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    5756PASS document.styleSheets[1].cssRules.length is 0
    5857PASS document.styleSheets[1].cssRules.length is 0
    59 PASS document.styleSheets[1].cssRules.length is 0
    6058PASS document.querySelectorAll(":dir\").length threw exception SyntaxError: Unexpected EOF.
    6159PASS document.querySelectorAll(":dir\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    7068PASS document.querySelectorAll(":dir\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    7169PASS document.querySelectorAll(":dir\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    72 PASS document.querySelectorAll(":dir\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    7370PASS document.querySelectorAll(":dir\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    7471PASS document.querySelectorAll(":dir\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    111108PASS document.styleSheets[1].cssRules.length is 0
    112109PASS document.styleSheets[1].cssRules.length is 0
    113 PASS document.styleSheets[1].cssRules.length is 0
    114110PASS document.querySelectorAll(":lang\").length threw exception SyntaxError: Unexpected EOF.
    115111PASS document.querySelectorAll(":lang\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    124120PASS document.querySelectorAll(":lang\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    125121PASS document.querySelectorAll(":lang\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    126 PASS document.querySelectorAll(":lang\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    127122PASS document.querySelectorAll(":lang\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    128123PASS document.querySelectorAll(":lang\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    165160PASS document.styleSheets[1].cssRules.length is 0
    166161PASS document.styleSheets[1].cssRules.length is 0
    167 PASS document.styleSheets[1].cssRules.length is 0
    168162PASS document.querySelectorAll(":not\").length threw exception SyntaxError: Unexpected EOF.
    169163PASS document.querySelectorAll(":not\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    178172PASS document.querySelectorAll(":not\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    179173PASS document.querySelectorAll(":not\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    180 PASS document.querySelectorAll(":not\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    181174PASS document.querySelectorAll(":not\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    182175PASS document.querySelectorAll(":not\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    219212PASS document.styleSheets[1].cssRules.length is 0
    220213PASS document.styleSheets[1].cssRules.length is 0
    221 PASS document.styleSheets[1].cssRules.length is 0
    222214PASS document.querySelectorAll(":nth-child\").length threw exception SyntaxError: Unexpected EOF.
    223215PASS document.querySelectorAll(":nth-child\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    232224PASS document.querySelectorAll(":nth-child\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    233225PASS document.querySelectorAll(":nth-child\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    234 PASS document.querySelectorAll(":nth-child\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    235226PASS document.querySelectorAll(":nth-child\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    236227PASS document.querySelectorAll(":nth-child\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    273264PASS document.styleSheets[1].cssRules.length is 0
    274265PASS document.styleSheets[1].cssRules.length is 0
    275 PASS document.styleSheets[1].cssRules.length is 0
    276266PASS document.querySelectorAll(":nth-last-child\").length threw exception SyntaxError: Unexpected EOF.
    277267PASS document.querySelectorAll(":nth-last-child\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    286276PASS document.querySelectorAll(":nth-last-child\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    287277PASS document.querySelectorAll(":nth-last-child\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    288 PASS document.querySelectorAll(":nth-last-child\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    289278PASS document.querySelectorAll(":nth-last-child\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    290279PASS document.querySelectorAll(":nth-last-child\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    327316PASS document.styleSheets[1].cssRules.length is 0
    328317PASS document.styleSheets[1].cssRules.length is 0
    329 PASS document.styleSheets[1].cssRules.length is 0
    330318PASS document.querySelectorAll(":nth-last-of-type\").length threw exception SyntaxError: Unexpected EOF.
    331319PASS document.querySelectorAll(":nth-last-of-type\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    340328PASS document.querySelectorAll(":nth-last-of-type\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    341329PASS document.querySelectorAll(":nth-last-of-type\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    342 PASS document.querySelectorAll(":nth-last-of-type\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    343330PASS document.querySelectorAll(":nth-last-of-type\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    344331PASS document.querySelectorAll(":nth-last-of-type\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    381368PASS document.styleSheets[1].cssRules.length is 0
    382369PASS document.styleSheets[1].cssRules.length is 0
    383 PASS document.styleSheets[1].cssRules.length is 0
    384370PASS document.querySelectorAll(":nth-of-type\").length threw exception SyntaxError: Unexpected EOF.
    385371PASS document.querySelectorAll(":nth-of-type\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    394380PASS document.querySelectorAll(":nth-of-type\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    395381PASS document.querySelectorAll(":nth-of-type\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    396 PASS document.querySelectorAll(":nth-of-type\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    397382PASS document.querySelectorAll(":nth-of-type\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    398383PASS document.querySelectorAll(":nth-of-type\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    435420PASS document.styleSheets[1].cssRules.length is 0
    436421PASS document.styleSheets[1].cssRules.length is 0
    437 PASS document.styleSheets[1].cssRules.length is 0
    438422PASS document.querySelectorAll(":matches\").length threw exception SyntaxError: Unexpected EOF.
    439423PASS document.querySelectorAll(":matches\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    448432PASS document.querySelectorAll(":matches\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    449433PASS document.querySelectorAll(":matches\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    450 PASS document.querySelectorAll(":matches\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    451434PASS document.querySelectorAll(":matches\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    452435PASS document.querySelectorAll(":matches\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    489472PASS document.styleSheets[1].cssRules.length is 0
    490473PASS document.styleSheets[1].cssRules.length is 0
    491 PASS document.styleSheets[1].cssRules.length is 0
    492474PASS document.querySelectorAll(":role\").length threw exception SyntaxError: Unexpected EOF.
    493475PASS document.querySelectorAll(":role\\").length threw exception SyntaxError: The string did not match the expected pattern..
     
    502484PASS document.querySelectorAll(":role\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    503485PASS document.querySelectorAll(":role\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    504 PASS document.querySelectorAll(":role\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    505486PASS document.querySelectorAll(":role\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
    506487PASS document.querySelectorAll(":role\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
     
    543524PASS document.styleSheets[1].cssRules.length is 0
    544525PASS document.styleSheets[1].cssRules.length is 0
    545 PASS document.styleSheets[1].cssRules.length is 0
    546526PASS successfullyParsed is true
    547527
  • trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html

    r176545 r243691  
    2222            ':' + functonalPseudoClassName + '\\\\\\ .foo',
    2323            ':' + functonalPseudoClassName + '\\\\\\\\ .foo',
    24             ':' + functonalPseudoClassName + '\\( .foo',
    2524            ':' + functonalPseudoClassName + '\\\\( .foo',
    2625            ':' + functonalPseudoClassName + '\\\\\\( .foo',
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r243669 r243691  
     12019-04-01  Emilio Cobos Álvarez  <emilio@crisal.io>
     2
     3        Be less strict about closing blocks in attribute and functional pseudo-element selectors.
     4        https://bugs.webkit.org/show_bug.cgi?id=142167
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * web-platform-tests/dom/nodes/selectors.js: Add tests for ::slotted
     9
    1102019-03-29  Chris Dumez  <cdumez@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/missing-right-token-expected.txt

    r232903 r243691  
    11
    2 FAIL attribute selectors with missing right tokens succeed The string did not match the expected pattern.
     2PASS attribute selectors with missing right tokens succeed
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-matches-expected.txt

    r229544 r243691  
    9494PASS In-document Element.matches: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected]
    9595PASS In-document Element.matches: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"]
    96 FAIL In-document Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" The string did not match the expected pattern.
     96PASS In-document Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center"
    9797PASS In-document Element.matches: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""]
    9898PASS In-document Element.matches: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"]
     
    257257PASS Detached Element.matches: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected]
    258258PASS Detached Element.matches: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"]
    259 FAIL Detached Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" The string did not match the expected pattern.
     259PASS Detached Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center"
    260260PASS Detached Element.matches: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""]
    261261PASS Detached Element.matches: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"]
     
    415415PASS Fragment Element.matches: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected]
    416416PASS Fragment Element.matches: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"]
    417 FAIL Fragment Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" The string did not match the expected pattern.
     417PASS Fragment Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center"
    418418PASS Fragment Element.matches: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""]
    419419PASS Fragment Element.matches: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-webkitMatchesSelector-expected.txt

    r229544 r243691  
    9494PASS In-document Element.webkitMatchesSelector: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected]
    9595PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"]
    96 FAIL In-document Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" The string did not match the expected pattern.
     96PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center"
    9797PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""]
    9898PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"]
     
    257257PASS Detached Element.webkitMatchesSelector: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected]
    258258PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"]
    259 FAIL Detached Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" The string did not match the expected pattern.
     259PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center"
    260260PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""]
    261261PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"]
     
    415415PASS Fragment Element.webkitMatchesSelector: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected]
    416416PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"]
    417 FAIL Fragment Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" The string did not match the expected pattern.
     417PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center"
    418418PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""]
    419419PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt

    r229544 r243691  
    346346PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    347347PASS Document.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    348 FAIL Document.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    349 FAIL Document.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     348PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     349PASS Document.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    350350PASS Document.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    351351PASS Document.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    734734PASS Document.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    735735PASS Document.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     736PASS Document.querySelectorAll: Slotted selector: ::slotted(foo)
     737PASS Document.querySelector: Slotted selector: ::slotted(foo)
     738PASS Document.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     739PASS Document.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    736740PASS Detached Element.querySelectorAll: Type selector, matching html element: html
    737741PASS Detached Element.querySelector: Type selector, matching html element: html
     
    766770PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    767771PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    768 FAIL Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    769 FAIL Detached Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     772PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     773PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    770774PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    771775PASS Detached Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    11541158PASS Detached Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    11551159PASS Detached Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     1160PASS Detached Element.querySelectorAll: Slotted selector: ::slotted(foo)
     1161PASS Detached Element.querySelector: Slotted selector: ::slotted(foo)
     1162PASS Detached Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     1163PASS Detached Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    11561164PASS Fragment.querySelectorAll: Type selector, matching html element: html
    11571165PASS Fragment.querySelector: Type selector, matching html element: html
     
    11861194PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    11871195PASS Fragment.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    1188 FAIL Fragment.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    1189 FAIL Fragment.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     1196PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     1197PASS Fragment.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    11901198PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    11911199PASS Fragment.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    15741582PASS Fragment.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    15751583PASS Fragment.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     1584PASS Fragment.querySelectorAll: Slotted selector: ::slotted(foo)
     1585PASS Fragment.querySelector: Slotted selector: ::slotted(foo)
     1586PASS Fragment.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     1587PASS Fragment.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    15761588PASS In-document Element.querySelectorAll: Type selector, matching html element: html
    15771589PASS In-document Element.querySelector: Type selector, matching html element: html
     
    16061618PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    16071619PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    1608 FAIL In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    1609 FAIL In-document Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     1620PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     1621PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    16101622PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    16111623PASS In-document Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    19962008PASS In-document Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    19972009PASS In-document Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     2010PASS In-document Element.querySelectorAll: Slotted selector: ::slotted(foo)
     2011PASS In-document Element.querySelector: Slotted selector: ::slotted(foo)
     2012PASS In-document Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     2013PASS In-document Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    19982014
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt

    r229544 r243691  
    346346PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    347347PASS Document.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    348 FAIL Document.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    349 FAIL Document.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     348PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     349PASS Document.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    350350PASS Document.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    351351PASS Document.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    734734PASS Document.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    735735PASS Document.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     736PASS Document.querySelectorAll: Slotted selector: ::slotted(foo)
     737PASS Document.querySelector: Slotted selector: ::slotted(foo)
     738PASS Document.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     739PASS Document.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    736740PASS Detached Element.querySelectorAll: Type selector, matching html element: html
    737741PASS Detached Element.querySelector: Type selector, matching html element: html
     
    766770PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    767771PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    768 FAIL Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    769 FAIL Detached Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     772PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     773PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    770774PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    771775PASS Detached Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    11541158PASS Detached Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    11551159PASS Detached Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     1160PASS Detached Element.querySelectorAll: Slotted selector: ::slotted(foo)
     1161PASS Detached Element.querySelector: Slotted selector: ::slotted(foo)
     1162PASS Detached Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     1163PASS Detached Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    11561164PASS Fragment.querySelectorAll: Type selector, matching html element: html
    11571165PASS Fragment.querySelector: Type selector, matching html element: html
     
    11861194PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    11871195PASS Fragment.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    1188 FAIL Fragment.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    1189 FAIL Fragment.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     1196PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     1197PASS Fragment.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    11901198PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    11911199PASS Fragment.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    15741582PASS Fragment.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    15751583PASS Fragment.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     1584PASS Fragment.querySelectorAll: Slotted selector: ::slotted(foo)
     1585PASS Fragment.querySelector: Slotted selector: ::slotted(foo)
     1586PASS Fragment.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     1587PASS Fragment.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    15761588PASS In-document Element.querySelectorAll: Type selector, matching html element: html
    15771589PASS In-document Element.querySelector: Type selector, matching html element: html
     
    16061618PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    16071619PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"]
    1608 FAIL In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
    1609 FAIL In-document Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" The string did not match the expected pattern.
     1620PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
     1621PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center"
    16101622PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
    16111623PASS In-document Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""]
     
    19962008PASS In-document Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong
    19972009PASS In-document Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong
     2010PASS In-document Element.querySelectorAll: Slotted selector: ::slotted(foo)
     2011PASS In-document Element.querySelector: Slotted selector: ::slotted(foo)
     2012PASS In-document Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo
     2013PASS In-document Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo
    19982014
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/selectors.js

    r229544 r243691  
    372372  {name: "Syntax, group of selectors separator, whitespace before",        selector: "#group em\t\r\n,#group strong",         expect: ["group-em1", "group-strong1"], level: 1, testType: TEST_QSA | TEST_MATCH},
    373373  {name: "Syntax, group of selectors separator, no whitespace",            selector: "#group em,#group strong",               expect: ["group-em1", "group-strong1"], level: 1, testType: TEST_QSA | TEST_MATCH},
     374
     375  // ::slotted (shouldn't match anything, but is a valid selector)
     376  {name: "Slotted selector", selector: "::slotted(foo)", expect: [], level: 3, testType: TEST_QSA},
     377  {name: "Slotted selector (no matching closing paren)", selector: "::slotted(foo", expect: [], level: 3, testType: TEST_QSA},
    374378];
    375379
  • trunk/Source/WebCore/ChangeLog

    r243690 r243691  
     12019-04-01  Emilio Cobos Álvarez  <emilio@crisal.io>
     2
     3        Be less strict about closing blocks in attribute and functional pseudo-element selectors.
     4        https://bugs.webkit.org/show_bug.cgi?id=142167
     5
     6        Reviewed by Antti Koivisto.
     7
     8        This was also an issue for, e.g., "::slotted(foo", turns out.
     9
     10        This matches Chromium, Firefox, and the spec:
     11
     12        https://drafts.csswg.org/css-syntax/#parse-error:
     13
     14        > Certain points in the parsing algorithm are said to be parse errors. The error
     15        > handling for parse errors is well-defined: user agents must either act as
     16        > described below when encountering such problems, or must abort processing at
     17        > the first error that they encounter for which they do not wish to apply the
     18        > rules described below.
     19
     20        https://drafts.csswg.org/css-syntax/#consume-simple-block:
     21
     22        > <EOF-token>
     23        >   This is a parse error. Return the block.
     24
     25        Tests: web-platform-tests/dom/nodes/selectors.js (and probably others)
     26
     27        * css/parser/CSSSelectorParser.cpp:
     28        (WebCore::CSSSelectorParser::consumeAttribute):
     29        (WebCore::CSSSelectorParser::consumePseudo):
     30
    1312019-04-01  Pablo Saavedra  <psaavedra@igalia.com>
    232
  • trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp

    r237932 r243691  
    399399    ASSERT(range.peek().type() == LeftBracketToken);
    400400    CSSParserTokenRange block = range.consumeBlock();
    401     if (block.end() == range.end())
    402         return nullptr; // No ] was found. Be strict about this.
    403 
    404401    block.consumeWhitespace();
    405402
     
    521518
    522519    CSSParserTokenRange block = range.consumeBlock();
    523     if (block.end() == range.end())
    524         return nullptr; // No ) was found. Be strict about this.
    525520    block.consumeWhitespace();
    526521    if (token.type() != FunctionToken)
Note: See TracChangeset for help on using the changeset viewer.