blob: eed7e51c0f132ed85d97ebe5dcc62c8afc2e4121 (
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
|
<html>
<head>
<style>
div[foo] { background-color: green; }
div[bar] > div { background-color: red; }
div[baz] ~ div { background-color: blue; }
</style>
</head>
<body>
<div id=bar><div>RED</div></div>
<div id=foo>GREEN</div>
<div id=baz></div>
<div>BLUE</div>
<script>
setTimeout(function() {
for (let id of ["foo", "bar", "baz"]) {
let e = document.getElementById(id);
e.setAttribute(id, "");
}
setTimeout(function() {
for (let id of ["foo", "bar", "baz"]) {
let e = document.getElementById(id);
e.removeAttribute(id);
}
}, 1000);
}, 1000);
</script>
</body>
</html>
|