mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Cargoify servo
This commit is contained in:
parent
db2f642c32
commit
c6ab60dbfc
1761 changed files with 8423 additions and 2294 deletions
70
tests/content/test_parentNode_querySelector.html
Normal file
70
tests/content/test_parentNode_querySelector.html
Normal file
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo"></div>
|
||||
<div id="foo\bar"></div>
|
||||
<div id="foo:bar"></div>
|
||||
<div id="bar" class="myClass"></p>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue