From 140c8a2c352df047d2e60bfdef1169364daf2af7 Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Thu, 17 Sep 2020 20:39:45 -0700 Subject: [PATCH] CSS: Retire expansion-based implementation of :is and :where We no longer attempt to expand :is and :where during style sheet loading. Correct support for these selectors remains to be implemented. In particular, we need: - invalidation - RuleFeatureSet - support for empty selector lists - error recovery - CSSSelectorParser Bug: 1127347 Change-Id: I28912cf5cb9b373c423d488b47c20251917329fe Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405034 Commit-Queue: Eric Willigers Reviewed-by: Anders Hartvoll Ruud Cr-Commit-Position: refs/heads/master@{#808207} --- css/selectors/query/is.html | 57 +++++++++++++++++++++++++++++++++ css/selectors/query/where.html | 57 +++++++++++++++++++++++++++++++++ css/support/query-testcommon.js | 18 +++++++++++ 3 files changed, 132 insertions(+) create mode 100644 css/selectors/query/is.html create mode 100644 css/selectors/query/where.html create mode 100644 css/support/query-testcommon.js diff --git a/css/selectors/query/is.html b/css/selectors/query/is.html new file mode 100644 index 00000000000000..918eaee7019e7e --- /dev/null +++ b/css/selectors/query/is.html @@ -0,0 +1,57 @@ + + + + + Selectors Level 4: query using :is() + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/css/selectors/query/where.html b/css/selectors/query/where.html new file mode 100644 index 00000000000000..b7cf5e1b204aea --- /dev/null +++ b/css/selectors/query/where.html @@ -0,0 +1,57 @@ + + + + + Selectors Level 4: query using :where() + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/css/support/query-testcommon.js b/css/support/query-testcommon.js new file mode 100644 index 00000000000000..73246e17e879ec --- /dev/null +++ b/css/support/query-testcommon.js @@ -0,0 +1,18 @@ +'use strict'; + +function test_query_selector(parentNode, selector, expected) { + if (!Array.isArray(expected)) + expected = [ expected ]; + + test(function(){ + const elementList = parentNode.querySelectorAll(selector); + assert_equals(elementList.length, expected.length); + + for (let i = 0; i < elementList.length; ++i) { + if (typeof expected[i] === 'string') + assert_equals(elementList[i].id, expected[i]); + else + assert_equals(elementList[i], expected[i]); + } + }, "Selector '" + selector + '" should find the expected elements'); +}