Skip to content

Commit

Permalink
Apply the resolution of csswg issue #6952 : disallow nesting :has()
Browse files Browse the repository at this point in the history
Remove nesting :has() cases from the existing wpt tests and add a
tentative wpt test to check disallowing nesting :has() inside :has().

w3c/csswg-drafts#6952 (comment)

Bug: 669058, 1334631
Change-Id: I549ee9d5b1ca17d22f7f8982d0e9ff96df6937df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3697654
Commit-Queue: Byungwoo Lee <blee@igalia.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013385}
NOKEYCHECK=True
GitOrigin-RevId: e4a649a2f73af3e9d9445e6b27522ba18572d740
  • Loading branch information
byung-woo authored and copybara-github committed Jun 13, 2022
1 parent 9800f52 commit fc7187c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 111 deletions.
4 changes: 0 additions & 4 deletions blink/web_tests/external/wpt/css/selectors/has-basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
test_selector_all(':has(:is(.target ~ .sibling .descendant))', [a, h, j]);
test_selector_all('.parent:has(:is(.target ~ .sibling .descendant))', [h]);
test_selector_all('.sibling:has(.descendant) ~ .target', [e]);
test_selector_all(':has(.sibling:has(.descendant) ~ .target)', [a, b]);
test_selector_all(
':has(.sibling:has(.descendant) ~ .target) ~ .parent > .descendant',
[g, i, j]);
test_selector_all(':has(> .parent)', [a]);
test_selector_all(':has(> .target)', [b, f, h]);
test_selector_all(':has(> .parent, > .target)', [a, b, f, h]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@
test_selector_all('.y:has(.g .h)', [d63, d68, d71])
test_selector_all('.y:has(> .g .h) .i', [d67, d75])
test_selector_all('.y:has(.g .h) .i', [d67, d75])
test_selector_all('.x:has(+ .y:has(> .g .h) .i)', [d62, d70])
test_selector_all('.x:has(+ .y:has(.g .h) .i)', [d62, d63, d70])
test_selector_all('.x:has(+ .y:has(> .g .h) .i) ~ .j', [d77, d80])
test_selector_all('.x:has(+ .y:has(.g .h) .i) ~ .j', [d77, d80])
test_selector_all('.x:has(~ .y:has(> .g .h) .i)', [d61, d62, d69, d70])
test_selector_all('.x:has(~ .y:has(.g .h) .i)', [d61, d62, d63, d69, d70])

test_selector_all('.d .x:has(.e)', [d51, d52])

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Selectors: The relational pseudo-class (disallow nesting :has() inside :has())</title>
<link rel="author" title="Byungwoo Lee" href="mailto:blee@igalia.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#has-pseudo">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script>
test_valid_selector('.a:has(.b:has(.c))', '.a:has()');
test_valid_selector('.a:has(.b:has(.c), .d)', '.a:has(.d)');
test_valid_selector('.a:has(.b:is(.c:has(.d) .e))', '.a:has(.b:is())');
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
test_valid_selector('.a .b:has(.c)');
test_valid_selector('.a .b:has(.c .d)');
test_valid_selector('.a .b:has(.c .d) .e');
test_valid_selector('.a:has(.b:has(.c))');
test_valid_selector('.a:has(.b:is(.c .d))');
test_valid_selector('.a:has(.b:is(.c:has(.d) .e))');
test_valid_selector('.a:is(.b:has(.c) .d)');
test_valid_selector('.a:not(:has(.b))');
test_valid_selector('.a:has(:not(.b))');
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit fc7187c

Please sign in to comment.