-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathrevert-rule-important.html
More file actions
52 lines (50 loc) · 1.29 KB
/
revert-rule-important.html
File metadata and controls
52 lines (50 loc) · 1.29 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
<!DOCTYPE html>
<title>The revert-rule keyword: interaction with !important</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>
#test1 {
color: revert-rule !important;
}
#test1 {
color: green;
}
</style>
<div id="test1"></div>
<script>
test(() => {
assert_true(CSS.supports('color:revert-rule'));
assert_equals(getComputedStyle(test1).color, 'rgb(0, 128, 0)');
}, 'revert-rule in !important declaration reverts to later normal rule if the !important rule comes first');
</script>
<style>
@layer {
#test2 {
color: revert-rule !important;
}
}
#test2 {
color: green;
}
</style>
<div id='test2'></div>
<script>
test(() => {
assert_equals(getComputedStyle(test2).color, 'rgb(0, 128, 0)');
}, 'revert-rule in !important declaration reverts across layers');
</script>
<style>
#test3 {
color: green;
}
#test3 {
color: revert-rule !important;
}
</style>
<div id='test3'></div>
<script>
test(() => {
assert_equals(getComputedStyle(test3).color, 'rgb(0, 128, 0)');
}, 'revert-rule in !important declaration reverts to earlier normal rule if the !important rule comes later');
</script>