diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/selectors/has-specificity.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/selectors/has-specificity.html')
-rw-r--r-- | testing/web-platform/tests/css/selectors/has-specificity.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/selectors/has-specificity.html b/testing/web-platform/tests/css/selectors/has-specificity.html new file mode 100644 index 0000000000..69fcb5b1fb --- /dev/null +++ b/testing/web-platform/tests/css/selectors/has-specificity.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<title>Specificity for complex :has selectors</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://drafts.csswg.org/selectors/#specificity-rules"> +<style> + main :has(#foo) { --t0:PASS; } + main :has(.foo) { --t0:FAIL; } + + main :has(span#foo) { --t1:PASS; } + main :has(#foo) { --t1:FAIL; } + + main :has(.bar, #foo) { --t2:FAIL; } + main :has(#foo, .bar) { --t2:PASS; } + + main :has(.bar, #foo) { --t3:PASS; } + main :has(.foo, .bar) { --t3:FAIL; } + + main :has(span + span) { --t4:PASS; } + main :has(span) { --t4:FAIL; } + + main :has(span, li, #foo) { --t5:PASS; } + main :has(span, li, p) { --t5:FAIL; } + + main div:has(.foo) { --t6:FAIL; } + main div.baz { --t6:PASS; } + + main div.baz { --t7:FAIL; } + main div:has(.foo) { --t7:PASS; } +</style> +<main id=main> + <div id=div class=baz><p><span id=foo class=foo></span><span class=bar></span><li></li></p></div> +</main> +<script> + function test_value(name, description) { + test(function() { + let actual = getComputedStyle(div).getPropertyValue(name); + assert_equals(actual, 'PASS'); + }, description); + } + + test_value('--t0', ':has(#foo) wins over :has(.foo)'); + test_value('--t1', ':has(span#foo) wins over :has(#foo)'); + test_value('--t2', ':has(.bar, #foo) has same specificity as :has(#foo, .bar)'); + test_value('--t3', ':has(.bar, #foo) wins over :has(.foo, .bar)'); + test_value('--t4', ':has(span + span) wins over :has(span)'); + test_value('--t5', ':has(span, li, p) wins over :has(span, lo, p)'); + test_value('--t6', 'latter .baz wins over :has(.foo)'); + test_value('--t7', 'latter :has(.foo) wins over .baz'); +</script> |