Bug 1705703 [wpt PR 28542] - Consume whitespace after nested compound argument, a=testonly
authorAnders Hartvoll Ruud <andruud@chromium.org>
Fri, 23 Apr 2021 10:21:53 +0000
changeset 577269 002fe8cf15bbb7a9302f79ca7d58f82f2526ae14
parent 577268 f32526e97995b91d7cb8a92263788d2f2a777050
child 577270 224a521bdf6dd33260c8e2eacafa8d6c75ad63a8
push id38403
push usercsabou@mozilla.com
push dateSat, 24 Apr 2021 09:00:50 +0000
treeherdermozilla-central@3a7d9d49c316 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1705703, 28542, 1199653, 2831652, 873310
milestone90.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1705703 [wpt PR 28542] - Consume whitespace after nested compound argument, a=testonly Automatic update from web-platform-tests Consume whitespace after nested compound argument Currently :host(:is(div )) does not parse, but :is(:is(div )) does. This is because ConsumeComplexSelector cleans up trailing whitespace (effectively), but ConsumeCompoundSelector doesn't. Fixed: 1199653 Change-Id: I4fe52cfee1b5ef0fbde229b2ec7efb38740ed268 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2831652 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#873310} -- wpt-commits: 6572111c6427d9dcf07e90ff680201eae5333f2e wpt-pr: 28542
testing/web-platform/tests/css/selectors/is-where-parsing.html
--- a/testing/web-platform/tests/css/selectors/is-where-parsing.html
+++ b/testing/web-platform/tests/css/selectors/is-where-parsing.html
@@ -5,44 +5,49 @@
 <link rel="help" href="https://drafts.csswg.org/selectors-4/#zero-matches">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <style id="test-sheet">
   random-selector { color: blue; }
 </style>
 <script>
   let rule = document.getElementById("test-sheet").sheet.cssRules[0];
-  function assert_valid(expected_valid, pattern, description) {
+  function assert_valid(expected_valid, pattern, expected_pattern, description) {
     test(function() {
       for (let pseudo of ["is", "where"]) {
-        let selector = pattern.replace("{}", ":" + pseudo)
+        let selector = pattern.replace("{}", ":" + pseudo);
+        let expected_selector = selector;
+        if (expected_pattern != null)
+          expected_selector = expected_pattern.replace("{}", ":" + pseudo);
         rule.selectorText = "random-selector";
         rule.selectorText = selector;
         (expected_valid ? assert_equals : assert_not_equals)(
           rule.selectorText,
-          selector,
+          expected_selector,
           `${description}: ${selector}`
         );
       }
     }, description);
   }
 
-  assert_valid(true, "{}(div + bar, div ~ .baz)", "Multiple selectors with combinators");
+  assert_valid(true, "{}(div )", "{}(div)", "Trailing whitespace");
+  assert_valid(true, "{}(div + bar, div ~ .baz)", null, "Multiple selectors with combinators");
 
-  assert_valid(true, "{}(:is(div))", "Nested :is");
-  assert_valid(true, "{}(:where(div))", "Nested :where");
+  assert_valid(true, "{}(:is(div))", null, "Nested :is");
+  assert_valid(true, "{}(:where(div))", null, "Nested :where");
 
-  assert_valid(true, ":host({}(div))", "Nested inside :host, without combinators");
+  assert_valid(true, ":host({}(div))", null, "Nested inside :host, without combinators");
+  assert_valid(true, ":host({}(div ))", ":host({}(div))", "Nested inside :host, with trailing whitespace");
   // See https://github.com/w3c/csswg-drafts/issues/5093
-  assert_valid(false, ":host({}(div .foo))", "Nested inside :host, with combinators");
+  assert_valid(false, ":host({}(div .foo))", null, "Nested inside :host, with combinators");
 
-  assert_valid(true, "{}(:hover, :active)", "Pseudo-classes inside");
-  assert_valid(true, "{}(div):hover", "Pseudo-classes after");
-  assert_valid(true, "{}(div)::before", "Pseudo-elements after");
-  assert_valid(false, "{}(::before)", "Pseudo-elements inside");
+  assert_valid(true, "{}(:hover, :active)", null, "Pseudo-classes inside");
+  assert_valid(true, "{}(div):hover", null, "Pseudo-classes after");
+  assert_valid(true, "{}(div)::before", null, "Pseudo-elements after");
+  assert_valid(false, "{}(::before)", null, "Pseudo-elements inside");
 
-  assert_valid(true, "{}(div) + bar", "Combinators after");
-  assert_valid(true, "::part(foo):is(:hover)", "After part with simple pseudo-class");
-  assert_valid(false, "::part(foo):is([attr='value'])", "After part with invalid selector after");
+  assert_valid(true, "{}(div) + bar", null, "Combinators after");
+  assert_valid(true, "::part(foo):is(:hover)", null, "After part with simple pseudo-class");
+  assert_valid(false, "::part(foo):is([attr='value'])", null, "After part with invalid selector after");
 
-  assert_valid(true, ":not({}(div))", "Nested inside :not, without combinators");
-  assert_valid(true, ":not({}(div .foo))", "Nested inside :not, with combinators");
+  assert_valid(true, ":not({}(div))", null, "Nested inside :not, without combinators");
+  assert_valid(true, ":not({}(div .foo))", null, "Nested inside :not, with combinators");
 </script>