blob: f372a1b8150c770f7f6f07ad3be8b820ebd27cab (
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
|
<!DOCTYPE html>
<html>
<head>
<style>
span { color: green }
:default + span { color: red }
span.reverse { color: red }
:default + span.reverse { color: green }
input { display: none }
</style>
</head>
<body>
<form>
<div>
<input type="checkbox" checked="checked" id="foo">
<span>There should be no red.</span>
</div>
<div>
<input checked="checked" id="bar">
<span class="reverse">There should be no red.</span>
</div>
</form>
<script>
var foo = document.body.offsetWidth;
document.getElementById("foo").removeAttribute("type");
document.getElementById("bar").setAttribute("type", "checkbox");
</script>
</body>
</html>
|