servo/tests/content/test_parentNode_querySelector.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

70 lines
2.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="harness.js"></script>
</head>
<body>
<div id="foo"></div>
<div id="foo\bar"></div>
<div id="foo:bar"></div>
<div id="bar" class="myClass"></p>
<script>
{ // document.querySelector
let div = document.getElementById("foo");
is(document.querySelector("#foo"), div);
div = document.getElementById("foo\\bar");
is(document.querySelector("#foo\\\\bar"), div);
div = document.getElementById("foo:bar");
is(document.querySelector("#foo\\:bar"), div);
div = document.getElementById("bar");
is(document.querySelector("div.myClass"), div);
is(document.querySelector("div:nth-of-type(4)"), div);
}
{ // element.querySelector
let body = document.body;
let div = document.getElementById("foo");
is(body.querySelector("#foo"), div);
div = document.getElementById("foo\\bar");
is(body.querySelector("#foo\\\\bar"), div);
div = document.getElementById("foo:bar");
is(body.querySelector("#foo\\:bar"), div);
div = document.getElementById("bar");
is(body.querySelector("div.myClass"), div);
is(body.querySelector("div:nth-of-type(4)"), div);
}
{ // docfrag.querySelector
let docfrag = document.createDocumentFragment();
let div = document.createElement("div");
div.id = "foo";
div.className = "myClass";
let child = document.createElement("div");
div.appendChild(child);
docfrag.appendChild(div);
let p = document.createElement("p");
p.id = "bar";
p.className = "myClass";
docfrag.appendChild(p);
is(docfrag.querySelector("#foo"), div);
is(docfrag.querySelector("div.myClass"), div);
is(docfrag.querySelector("#bar"), p);
is(docfrag.querySelector("p.myClass"), p);
is(docfrag.querySelector(".myClass"), div);
is(docfrag.querySelector("div > div"), child);
}
finish();
</script>
</body>
</html>