Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1020)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/viewless-document.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script src="script-tests/viewless-document.js"></script> 7 <script>
8 description(
9 "This tests that querySelector, querySelectorAll and matchesSelector (webkitMatc hesSelector) don't crash when used in a viewless document."
10 );
11
12 var testDoc = document.implementation.createDocument("http://www.w3.org/1999/xht ml", "html");
13 testDoc.documentElement.appendChild(testDoc.createElement("body"));
14 testDoc.body.appendChild(testDoc.createElement("p")).id = "p1";
15 testDoc.getElementById("p1").appendChild(testDoc.createElement("span")).id = "s1 ";
16 testDoc.body.appendChild(testDoc.createElement("span")).id = "s2";
17 testDoc.body.appendChild(testDoc.createElement("div")).className = "d1";
18
19 var p1 = testDoc.getElementById("p1");
20 var s1 = testDoc.getElementById("s1");
21 var s2 = testDoc.getElementById("s2");
22 var d1 = testDoc.body.lastChild;
23
24 shouldBe("testDoc.querySelector('p')", "p1");
25 shouldBe("testDoc.querySelectorAll('span').length", "2");
26 shouldBe("testDoc.querySelectorAll('span').item(1)", "s2");
27 shouldBe("testDoc.querySelector('.d1')", "d1");
28 shouldBe("testDoc.querySelectorAll('p span').length", "1");
29
30 shouldBeTrue("p1.webkitMatchesSelector('p')");
31 shouldBeTrue("s1.webkitMatchesSelector('p span')");
32 shouldBeTrue("s2.webkitMatchesSelector('#s2')");
33 shouldBeTrue("d1.webkitMatchesSelector('.d1')");
34 </script>
8 </body> 35 </body>
9 </html> 36 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698