-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathrevert-rule-layer.html
More file actions
51 lines (48 loc) · 1.04 KB
/
revert-rule-layer.html
File metadata and controls
51 lines (48 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<title>The revert-rule keyword: interaction with @layer</title>
<link rel="help" href="https://drafts.csswg.org/css-cascade-5/#revert-rule-keyword">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@layer {
#test1 {
color: green;
}
}
@layer {
#test1 {
color: red;
color: revert-rule;
}
}
</style>
<div id=test1></div>
<script>
test(() => {
assert_true(CSS.supports('color:revert-rule'));
assert_equals(getComputedStyle(test1).color, 'rgb(0, 128, 0)')
}, 'The revert-rule keyword can cross layers');
</script>
<style>
@layer {
#test2 {
color: red;
}
}
@layer {
#test2 {
color: green;
}
#test2 {
color: red;
color: revert-rule;
}
}
</style>
<div id=test2></div>
<script>
test(() => {
assert_true(CSS.supports('color:revert-rule'));
assert_equals(getComputedStyle(test2).color, 'rgb(0, 128, 0)')
}, 'The revert-rule does not unconditionally cross layers');
</script>