-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathnot-001.html
More file actions
41 lines (39 loc) · 1.33 KB
/
not-001.html
File metadata and controls
41 lines (39 loc) · 1.33 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
<!DOCTYPE html>
<title>CSS Selectors Invalidation: complex :not()</title>
<link rel="help" href="https://drafts.csswg.org/selectors-4/#negation">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
* {
color: yellow;
}
:not(.b ~ *) {
color: green;
}
</style>
<div id="b">
</div>
<div class="c">
</div>
<div class="d">
</div>
<script>
var black = "rgb(0, 0, 0)";
var blue = "rgb(0, 0, 255)";
var green = "rgb(0, 128, 0)";
var red = "rgb(255, 0, 0)";
var yellow = "rgb(255, 255, 0)";
test(() => {
assert_equals(getComputedStyle(document.querySelector("#b")).color, green);
assert_equals(getComputedStyle(document.querySelector(".c")).color, green);
assert_equals(getComputedStyle(document.querySelector(".d")).color, green);
}, "precondition");
test(() => {
document.getElementById("b").className = "b";
assert_equals(getComputedStyle(document.querySelector("#b")).color, green);
assert_equals(getComputedStyle(document.querySelector(".c")).color, yellow);
assert_equals(getComputedStyle(document.querySelector(".d")).color, yellow);
}, "Invalidation of sibling combinators in :not()");
</script>