Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / SelectorAPI / resources / id-fastpath-almost-strict.js
bloba00ee6c9d86c36f776a19f86b2c7318462a8a064
1 description(
2 "This tests that the querySelector and querySelectorAll fast path for IDs in almost strict mode."
3 );
5 var root = document.createElement('div');
6 var correctNode = document.createElement('div');
7 correctNode.setAttribute("id", "testId")
8 root.appendChild(correctNode);
9 document.body.appendChild(root);
11 shouldBe("document.querySelector('#testId')", "correctNode");
12 shouldBe("document.querySelector('div#testId')", "correctNode");
13 shouldBeNull("document.querySelector('ul#testId')");
14 shouldBeNull("document.querySelector('ul #testId')");
15 shouldBeNull("document.querySelector('#testId[attr]')");
16 shouldBeNull("document.querySelector('#testId:not(div)')");
18 shouldBe("document.querySelectorAll('div#testId').length", "1");
19 shouldBe("document.querySelectorAll('div#testId').item(0)", "correctNode");
20 shouldBe("document.querySelectorAll('#testId').length", "1");
21 shouldBe("document.querySelectorAll('#testId').item(0)", "correctNode");
22 shouldBe("document.querySelectorAll('ul#testId').length", "0");
23 shouldBe("document.querySelectorAll('ul #testId').length", "0");
24 shouldBe("document.querySelectorAll('#testId[attr]').length", "0");
25 shouldBe("document.querySelectorAll('#testId:not(div)').length", "0");