servo/tests/content/test_element_className.html
Matt Brubeck fe123ad07c Switch to synchronous script loading
This removes the old code for asyncronously loading scripts during HTML
parsing and then executing them afterward.

Fixes #3356.
2014-10-29 14:31:47 -07:00

38 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="harness.js"></script>
</head>
<body>
<div id="foo-1" class="foo"></div>
<div id="foo-2" class="baz"></div>
<script>
let foo1 = document.getElementById("foo-1");
let foo2 = document.getElementById("foo-2");
foo1.className += " bar";
is(foo1.className, "foo bar");
let foo3 = document.createElement("div");
foo3.id = "foo-3";
foo3.className = "foo";
document.body.appendChild(foo3);
is(foo3, document.getElementById("foo-3"));
let collection = document.getElementsByClassName("foo");
is(collection.length, 2);
is(collection[0].id, foo1.id);
is(collection[1].id, foo3.id);
collection = document.getElementsByClassName("bar");
is(collection.length, 1);
is(collection[0].id, foo1.id);
collection = document.getElementsByClassName("baz");
is(collection.length, 1);
is(collection[0].id, foo2.id);
finish();
</script>
</body>
</html>