summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/attribute-selector-recursive-update-on-setAttribute.html
blob: d5ef0bfc182e8e1978a12e25a97b344c0cd8f90e (plain)
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../resources/js-test.js"></script>
<style>
.entry[status="foo"] .toggle {
    color: green;
}
.entry[status="bar"] .toggle {
    color: red;
}
</style>
</head>
<body>
<div class="entry" status="foo">
    <span class="toggle">Text.</span>
</div>
<script>

description("This test checks that attribute selectors are recursively re-evaluated when the attribute changes.");

var entry= document.getElementsByClassName("entry")[0];
var toggle = document.getElementsByClassName("toggle")[0];

shouldBe("getComputedStyle(toggle).color", "'rgb(0, 128, 0)'");
entry.setAttribute("status", "bar");
shouldBe("getComputedStyle(toggle).color", "'rgb(255, 0, 0)'");

document.body.removeChild(entry);

</script>
</body>
</html>