blob: a9af7b43548fdb6bd11318d4e1773c92c1503251 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<!DOCTYPE html>
<style>
div { color: green; }
.red > span { color: red; }
</style>
<div id="first"><span></span></div>
<div id="second"><span>This text should be green.</span></div>
<script>
getComputedStyle(second.firstChild).color;
getComputedStyle(first.firstChild).color;
second.className = "red";
getComputedStyle(second.firstChild).color;
first.className = "red";
second.className = "";
getComputedStyle(second.firstChild).color;
</script>
|