Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / SelectorAPI / script-tests / elementRoot.js
blob650ae0da799f7a46f197507f6f878ec19e9bfdd5
1 description(
2 "This tests that querySelector and querySelectorAll don't search outside their root node."
3 );
5 var root = document.createElement('div');
6 var correctNode = document.createElement('div');
7 root.appendChild(correctNode);
8 document.body.appendChild(root);
9 var noChild = document.createElement('div');
10 document.body.appendChild(noChild);
12 shouldBe("root.querySelector('div')", "correctNode");
13 shouldBe("root.querySelectorAll('div').length", "1");
14 shouldBe("root.querySelectorAll('div').item(0)", "correctNode");
16 shouldBeNull("noChild.querySelector('div')");
17 shouldBe("noChild.querySelectorAll('div').length", "0");