blob: 5ee2f869a8a6b2e49b9cc7397ca79599d51548f6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<!doctype html>
<title>Element class test</title>
<div class="a b c">Fail</div>
<script src=asserts.js></script>
<script>
const div = document.getElementsByClassName("a")[0]
const classes = ["a", "b", "c"];
let cl = div.classList;
for (let i = 0; i < classes.length; ++i)
assert_equals(cl[i], classes[i]);
const classes2 = ["x", "y", "z"];
div.setAttribute("class", classes2.join(' '));
let i = 0;
for (let x of cl)
assert_equals(x, classes2[i++]);
div.textContent = "Success";
</script>
|