Title: [243691] trunk
Revision
243691
Author
emi...@crisal.io
Date
2019-04-01 05:50:44 -0700 (Mon, 01 Apr 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3-expected.txt (243690 => 243691)


--- trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3-expected.txt	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3-expected.txt	2019-04-01 12:50:44 UTC (rev 243691)
@@ -788,102 +788,6 @@
 PASS document.getElementById('style-container').sheet.cssRules.length is 0
 PASS document.getElementById('style-container').sheet.cssRules.length is 0
 PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo~=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo~=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo|=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo|=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo^=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo^=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo$=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo$=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo*=bar i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.querySelector("[foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[|foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[*|foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelector("[WebKit|foo*=\"bar\" i") threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
-PASS document.getElementById('style-container').sheet.cssRules.length is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3.html (243690 => 243691)


--- trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3.html	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/fast/css/parsing-css-attribute-case-insensitive-value-3.html	2019-04-01 12:50:44 UTC (rev 243691)
@@ -143,20 +143,6 @@
     '[foo$="bar" l]',
     '[foo*=bar l]',
     '[foo*="bar" l]',
-
-    // Missing the closing ']'.
-    '[foo=bar i',
-    '[foo="bar" i',
-    '[foo~=bar i',
-    '[foo~="bar" i',
-    '[foo|=bar i',
-    '[foo|="bar" i',
-    '[foo^=bar i',
-    '[foo^="bar" i',
-    '[foo$=bar i',
-    '[foo$="bar" i',
-    '[foo*=bar i',
-    '[foo*="bar" i',
 ];
 
 debug("Invalid selectors.");

Modified: trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt (243690 => 243691)


--- trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt	2019-04-01 12:50:44 UTC (rev 243691)
@@ -15,7 +15,6 @@
 PASS document.querySelectorAll(":-webkit-any\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":-webkit-any\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":-webkit-any\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":-webkit-any\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":-webkit-any\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":-webkit-any\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":-webkit-any\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -56,7 +55,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":dir\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":dir\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":dir\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -69,7 +67,6 @@
 PASS document.querySelectorAll(":dir\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":dir\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":dir\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":dir\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":dir\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":dir\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":dir\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -110,7 +107,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":lang\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":lang\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":lang\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -123,7 +119,6 @@
 PASS document.querySelectorAll(":lang\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":lang\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":lang\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":lang\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":lang\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":lang\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":lang\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -164,7 +159,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":not\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":not\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":not\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -177,7 +171,6 @@
 PASS document.querySelectorAll(":not\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":not\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":not\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":not\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":not\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":not\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":not\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -218,7 +211,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":nth-child\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":nth-child\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-child\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -231,7 +223,6 @@
 PASS document.querySelectorAll(":nth-child\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-child\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-child\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":nth-child\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-child\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-child\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-child\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -272,7 +263,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":nth-last-child\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":nth-last-child\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-child\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -285,7 +275,6 @@
 PASS document.querySelectorAll(":nth-last-child\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-child\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-child\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":nth-last-child\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-child\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-child\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-child\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -326,7 +315,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":nth-last-of-type\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":nth-last-of-type\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-of-type\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -339,7 +327,6 @@
 PASS document.querySelectorAll(":nth-last-of-type\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-of-type\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-of-type\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":nth-last-of-type\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-of-type\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-of-type\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-last-of-type\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -380,7 +367,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":nth-of-type\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":nth-of-type\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-of-type\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -393,7 +379,6 @@
 PASS document.querySelectorAll(":nth-of-type\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-of-type\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-of-type\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":nth-of-type\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-of-type\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-of-type\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":nth-of-type\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -434,7 +419,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":matches\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":matches\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":matches\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -447,7 +431,6 @@
 PASS document.querySelectorAll(":matches\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":matches\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":matches\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":matches\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":matches\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":matches\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":matches\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -488,7 +471,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS document.querySelectorAll(":role\").length threw exception SyntaxError: Unexpected EOF.
 PASS document.querySelectorAll(":role\\").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":role\\\").length threw exception SyntaxError: Unexpected EOF.
@@ -501,7 +483,6 @@
 PASS document.querySelectorAll(":role\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":role\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":role\\\\ .foo").length threw exception SyntaxError: The string did not match the expected pattern..
-PASS document.querySelectorAll(":role\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":role\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":role\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
 PASS document.querySelectorAll(":role\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern..
@@ -542,7 +523,6 @@
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
 PASS document.styleSheets[1].cssRules.length is 0
-PASS document.styleSheets[1].cssRules.length is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html (243690 => 243691)


--- trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html	2019-04-01 12:50:44 UTC (rev 243691)
@@ -21,7 +21,6 @@
             ':' + functonalPseudoClassName + '\\\\ .foo',
             ':' + functonalPseudoClassName + '\\\\\\ .foo',
             ':' + functonalPseudoClassName + '\\\\\\\\ .foo',
-            ':' + functonalPseudoClassName + '\\( .foo',
             ':' + functonalPseudoClassName + '\\\\( .foo',
             ':' + functonalPseudoClassName + '\\\\\\( .foo',
             ':' + functonalPseudoClassName + '\\\\\\\\( .foo',

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243690 => 243691)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-01 12:50:44 UTC (rev 243691)
@@ -1,3 +1,12 @@
+2019-04-01  Emilio Cobos Álvarez  <emi...@crisal.io>
+
+        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.
+
+        * web-platform-tests/dom/nodes/selectors.js: Add tests for ::slotted
+
 2019-03-29  Chris Dumez  <cdu...@apple.com>
 
         Make someWindow.frames, .self, .window always return someWindow

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/missing-right-token-expected.txt (243690 => 243691)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/missing-right-token-expected.txt	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/missing-right-token-expected.txt	2019-04-01 12:50:44 UTC (rev 243691)
@@ -1,3 +1,3 @@
 
-FAIL attribute selectors with missing right tokens succeed The string did not match the expected pattern.
+PASS attribute selectors with missing right tokens succeed 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-matches-expected.txt (243690 => 243691)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-matches-expected.txt	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-matches-expected.txt	2019-04-01 12:50:44 UTC (rev 243691)
@@ -93,7 +93,7 @@
 PASS In-document Element.matches: Attribute presence selector, matching option with selected attribute (with no refNodes): #attr-presence-select2 option[selected] 
 PASS In-document Element.matches: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected] 
 PASS In-document Element.matches: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"] 
-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.
+PASS In-document Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" 
 PASS In-document Element.matches: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""] 
 PASS In-document Element.matches: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"] 
 PASS In-document Element.matches: Attribute value selector, matching custom data-* attribute with escaped character (with no refNodes): [data-attr-value_foo="\e9"] 
@@ -256,7 +256,7 @@
 PASS Detached Element.matches: Attribute presence selector, matching option with selected attribute (with no refNodes): #attr-presence-select2 option[selected] 
 PASS Detached Element.matches: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected] 
 PASS Detached Element.matches: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"] 
-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.
+PASS Detached Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" 
 PASS Detached Element.matches: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""] 
 PASS Detached Element.matches: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"] 
 PASS Detached Element.matches: Attribute value selector, matching custom data-* attribute with escaped character (with no refNodes): [data-attr-value_foo="\e9"] 
@@ -414,7 +414,7 @@
 PASS Fragment Element.matches: Attribute presence selector, matching option with selected attribute (with no refNodes): #attr-presence-select2 option[selected] 
 PASS Fragment Element.matches: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected] 
 PASS Fragment Element.matches: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"] 
-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.
+PASS Fragment Element.matches: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" 
 PASS Fragment Element.matches: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""] 
 PASS Fragment Element.matches: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"] 
 PASS Fragment Element.matches: Attribute value selector, matching custom data-* attribute with escaped character (with no refNodes): [data-attr-value_foo="\e9"] 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-webkitMatchesSelector-expected.txt (243690 => 243691)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-webkitMatchesSelector-expected.txt	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-webkitMatchesSelector-expected.txt	2019-04-01 12:50:44 UTC (rev 243691)
@@ -93,7 +93,7 @@
 PASS In-document Element.webkitMatchesSelector: Attribute presence selector, matching option with selected attribute (with no refNodes): #attr-presence-select2 option[selected] 
 PASS In-document Element.webkitMatchesSelector: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected] 
 PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"] 
-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.
+PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" 
 PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""] 
 PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"] 
 PASS In-document Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with escaped character (with no refNodes): [data-attr-value_foo="\e9"] 
@@ -256,7 +256,7 @@
 PASS Detached Element.webkitMatchesSelector: Attribute presence selector, matching option with selected attribute (with no refNodes): #attr-presence-select2 option[selected] 
 PASS Detached Element.webkitMatchesSelector: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected] 
 PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"] 
-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.
+PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" 
 PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""] 
 PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"] 
 PASS Detached Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with escaped character (with no refNodes): [data-attr-value_foo="\e9"] 
@@ -414,7 +414,7 @@
 PASS Fragment Element.webkitMatchesSelector: Attribute presence selector, matching option with selected attribute (with no refNodes): #attr-presence-select2 option[selected] 
 PASS Fragment Element.webkitMatchesSelector: Attribute presence selector, matching multiple options with selected attributes (with no refNodes): #attr-presence-select3 option[selected] 
 PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value (with no refNodes): #attr-value [align="center"] 
-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.
+PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching align attribute with value, unclosed bracket (with no refNodes): #attr-value [align="center" 
 PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching align attribute with empty value (with no refNodes): #attr-value [align=""] 
 PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with unicode escaped value (with no refNodes): [data-attr-value="\e9"] 
 PASS Fragment Element.webkitMatchesSelector: Attribute value selector, matching custom data-* attribute with escaped character (with no refNodes): [data-attr-value_foo="\e9"] 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt (243690 => 243691)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt	2019-04-01 12:50:44 UTC (rev 243691)
@@ -345,8 +345,8 @@
 PASS Document.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS Document.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS Document.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS Document.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Document.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Document.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -733,6 +733,10 @@
 ,#group strong 
 PASS Document.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS Document.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS Document.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS Document.querySelector: Slotted selector: ::slotted(foo) 
+PASS Document.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS Document.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 PASS Detached Element.querySelectorAll: Type selector, matching html element: html 
 PASS Detached Element.querySelector: Type selector, matching html element: html 
 PASS Detached Element.querySelectorAll: Type selector, matching body element: body 
@@ -765,8 +769,8 @@
 PASS Detached Element.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Detached Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Detached Element.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -1153,6 +1157,10 @@
 ,#group strong 
 PASS Detached Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS Detached Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS Detached Element.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS Detached Element.querySelector: Slotted selector: ::slotted(foo) 
+PASS Detached Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS Detached Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 PASS Fragment.querySelectorAll: Type selector, matching html element: html 
 PASS Fragment.querySelector: Type selector, matching html element: html 
 PASS Fragment.querySelectorAll: Type selector, matching body element: body 
@@ -1185,8 +1193,8 @@
 PASS Fragment.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS Fragment.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS Fragment.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Fragment.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Fragment.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -1573,6 +1581,10 @@
 ,#group strong 
 PASS Fragment.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS Fragment.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS Fragment.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS Fragment.querySelector: Slotted selector: ::slotted(foo) 
+PASS Fragment.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS Fragment.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 PASS In-document Element.querySelectorAll: Type selector, matching html element: html 
 PASS In-document Element.querySelector: Type selector, matching html element: html 
 PASS In-document Element.querySelectorAll: Type selector, matching body element: body 
@@ -1605,8 +1617,8 @@
 PASS In-document Element.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS In-document Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS In-document Element.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -1995,4 +2007,8 @@
 ,#group strong 
 PASS In-document Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS In-document Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS In-document Element.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS In-document Element.querySelector: Slotted selector: ::slotted(foo) 
+PASS In-document Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS In-document Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt (243690 => 243691)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt	2019-04-01 12:50:44 UTC (rev 243691)
@@ -345,8 +345,8 @@
 PASS Document.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS Document.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS Document.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS Document.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS Document.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Document.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Document.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -733,6 +733,10 @@
 ,#group strong 
 PASS Document.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS Document.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS Document.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS Document.querySelector: Slotted selector: ::slotted(foo) 
+PASS Document.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS Document.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 PASS Detached Element.querySelectorAll: Type selector, matching html element: html 
 PASS Detached Element.querySelector: Type selector, matching html element: html 
 PASS Detached Element.querySelectorAll: Type selector, matching body element: body 
@@ -765,8 +769,8 @@
 PASS Detached Element.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS Detached Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS Detached Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Detached Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Detached Element.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -1153,6 +1157,10 @@
 ,#group strong 
 PASS Detached Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS Detached Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS Detached Element.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS Detached Element.querySelector: Slotted selector: ::slotted(foo) 
+PASS Detached Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS Detached Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 PASS Fragment.querySelectorAll: Type selector, matching html element: html 
 PASS Fragment.querySelector: Type selector, matching html element: html 
 PASS Fragment.querySelectorAll: Type selector, matching body element: body 
@@ -1185,8 +1193,8 @@
 PASS Fragment.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS Fragment.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS Fragment.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS Fragment.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Fragment.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS Fragment.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -1573,6 +1581,10 @@
 ,#group strong 
 PASS Fragment.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS Fragment.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS Fragment.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS Fragment.querySelector: Slotted selector: ::slotted(foo) 
+PASS Fragment.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS Fragment.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 PASS In-document Element.querySelectorAll: Type selector, matching html element: html 
 PASS In-document Element.querySelector: Type selector, matching html element: html 
 PASS In-document Element.querySelectorAll: Type selector, matching body element: body 
@@ -1605,8 +1617,8 @@
 PASS In-document Element.querySelector: Attribute presence selector, matching multiple options with selected attributes: #attr-presence-select3 option[selected] 
 PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
 PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value: #attr-value [align="center"] 
-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.
-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.
+PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
+PASS In-document Element.querySelector: Attribute value selector, matching align attribute with value, unclosed bracket: #attr-value [align="center" 
 PASS In-document Element.querySelectorAll: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS In-document Element.querySelector: Attribute value selector, matching align attribute with empty value: #attr-value [align=""] 
 PASS In-document Element.querySelectorAll: Attribute value selector, not matching align attribute with partial value: #attr-value [align="c"] 
@@ -1995,4 +2007,8 @@
 ,#group strong 
 PASS In-document Element.querySelectorAll: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
 PASS In-document Element.querySelector: Syntax, group of selectors separator, no whitespace: #group em,#group strong 
+PASS In-document Element.querySelectorAll: Slotted selector: ::slotted(foo) 
+PASS In-document Element.querySelector: Slotted selector: ::slotted(foo) 
+PASS In-document Element.querySelectorAll: Slotted selector (no matching closing paren): ::slotted(foo 
+PASS In-document Element.querySelector: Slotted selector (no matching closing paren): ::slotted(foo 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/selectors.js (243690 => 243691)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/selectors.js	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/selectors.js	2019-04-01 12:50:44 UTC (rev 243691)
@@ -371,6 +371,10 @@
   {name: "Syntax, group of selectors separator, whitespace after",         selector: "#group em,\t\r\n#group strong",         expect: ["group-em1", "group-strong1"], level: 1, testType: TEST_QSA | TEST_MATCH},
   {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},
   {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},
+
+  // ::slotted (shouldn't match anything, but is a valid selector)
+  {name: "Slotted selector", selector: "::slotted(foo)", expect: [], level: 3, testType: TEST_QSA},
+  {name: "Slotted selector (no matching closing paren)", selector: "::slotted(foo", expect: [], level: 3, testType: TEST_QSA},
 ];
 
 

Modified: trunk/Source/WebCore/ChangeLog (243690 => 243691)


--- trunk/Source/WebCore/ChangeLog	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/Source/WebCore/ChangeLog	2019-04-01 12:50:44 UTC (rev 243691)
@@ -1,3 +1,33 @@
+2019-04-01  Emilio Cobos Álvarez  <emi...@crisal.io>
+
+        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.
+
+        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):
+
 2019-04-01  Pablo Saavedra  <psaave...@igalia.com>
 
         Build failure after r243644 in GTK Linux 64-bit stable builds

Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (243690 => 243691)


--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2019-04-01 09:47:08 UTC (rev 243690)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2019-04-01 12:50:44 UTC (rev 243691)
@@ -398,9 +398,6 @@
 {
     ASSERT(range.peek().type() == LeftBracketToken);
     CSSParserTokenRange block = range.consumeBlock();
-    if (block.end() == range.end())
-        return nullptr; // No ] was found. Be strict about this.
-
     block.consumeWhitespace();
 
     AtomicString namespacePrefix;
@@ -520,8 +517,6 @@
     }
 
     CSSParserTokenRange block = range.consumeBlock();
-    if (block.end() == range.end())
-        return nullptr; // No ) was found. Be strict about this.
     block.consumeWhitespace();
     if (token.type() != FunctionToken)
         return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to