-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathnesting-revert-rule.html
More file actions
90 lines (82 loc) · 1.95 KB
/
nesting-revert-rule.html
File metadata and controls
90 lines (82 loc) · 1.95 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<title>The revert-rule keyword: interaction with nesting</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>
:root {
#test1 {
color: green;
}
#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 revert to a nested rule');
</script>
<style>
:root {
#test2 {
/* CSSNestedDeclarationsRule { */
color: green;
/* } */
& {
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 keyword can revert to a CSSNestedDeclarationsRule');
</script>
<style>
:root {
#test3 {
/* CSSNestedDeclarationsRule { */
color: green;
/* } */
.something {}
/* CSSNestedDeclarationsRule { */
color: red;
color: revert-rule;
/* } */
}
}
</style>
<div id=test3></div>
<script>
test(() => {
assert_true(CSS.supports('color:revert-rule'));
assert_equals(getComputedStyle(test3).color, 'rgb(0, 128, 0)')
}, 'The revert-rule keyword can revert from a CSSNestedDeclarationsRule');
</script>
<style>
@scope (#test4) {
/* CSSNestedDeclarationsRule { */
color: green;
/* } */
}
#test4 {
color: red;
color: revert-rule;
}
</style>
<div id=test4></div>
<script>
test(() => {
assert_true(CSS.supports('color:revert-rule'));
assert_equals(getComputedStyle(test4).color, 'rgb(0, 128, 0)')
}, 'The revert-rule keyword can revert to scoped declarations');
</script>