Files
Anders Hartvoll Ruud 64451ba528 Bug 1860511 [wpt PR 42682] - [@scope] Make CSSScopeRule a CSSGroupingRule, a=testonly
Automatic update from web-platform-tests
[@scope] Make CSSScopeRule a CSSGroupingRule

It was incorrectly specified as a CSSConditionRule in the IDL,
which is wrong. Note that the Blink class CSSScopeRule is already
implemented as a CSSGroupingRule, it's just the bindings that are
generated incorrectly.

Fixed: 1494377
Change-Id: If2ec91171efbcb815bfac2967f9e9eaf599dd941
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4965262
Reviewed-by: Philip Jägenstedt <[email protected]>
Commit-Queue: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1213415}

--

wpt-commits: 9f4d42729edb3a95978d7914f736847aeef6974d
wpt-pr: 42682
2023-10-31 13:59:52 +00:00

74 lines
1.9 KiB
HTML

<!DOCTYPE html>
<title>@scope - CSSOM</title>
<link rel="help" href="https://drafts.csswg.org/css-cascade-6/#the-cssscoperule-interface">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id=style>
@scope {}
@scope (.a) {}
@scope (.a) to (.b) {
div {
display: block;
}
}
@scope to (.b) {}
</style>
<script>
// CSSScopeRule.cssText
test(() => {
assert_equals(style.sheet.rules[0].cssText, '@scope {\n}');
}, 'CSSScopeRule.cssText, implicit scope');
test(() => {
assert_equals(style.sheet.rules[1].cssText, '@scope (.a) {\n}');
}, 'CSSScopeRule.cssText, root only');
test(() => {
assert_equals(style.sheet.rules[2].cssText, '@scope (.a) to (.b) {\n div { display: block; }\n}');
}, 'CSSScopeRule.cssText, root and limit');
test(() => {
assert_equals(style.sheet.rules[3].cssText, '@scope to (.b) {\n}');
}, 'CSSScopeRule.cssText, limit only');
// start
test(() => {
assert_equals(style.sheet.rules[0].start, null);
}, 'CSSScopeRule.start, implicit scope');
test(() => {
assert_equals(style.sheet.rules[1].start, '.a');
}, 'CSSScopeRule.start, root only');
test(() => {
assert_equals(style.sheet.rules[2].start, '.a');
}, 'CSSScopeRule.start, root and limit');
test(() => {
assert_equals(style.sheet.rules[3].start, null);
}, 'CSSScopeRule.start, limit only');
// end
test(() => {
assert_equals(style.sheet.rules[0].end, null);
}, 'CSSScopeRule.end, implicit scope');
test(() => {
assert_equals(style.sheet.rules[1].end, null);
}, 'CSSScopeRule.end, root only');
test(() => {
assert_equals(style.sheet.rules[2].end, '.b');
}, 'CSSScopeRule.end, root and limit');
test(() => {
assert_equals(style.sheet.rules[3].end, '.b');
}, 'CSSScopeRule.end, limit only');
test(() => {
assert_true(style.sheet.rules[0] instanceof CSSGroupingRule);
assert_false(style.sheet.rules[0] instanceof CSSConditionRule);
}, 'CSSScopeRule is a CSSGroupingRule');
</script>