29 lines
850 B
HTML
29 lines
850 B
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<script src="../../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
description(
|
|
"This tests that querySelector and querySelectorAll don't search outside their root node."
|
|
);
|
|
|
|
var root = document.createElement('div');
|
|
var correctNode = document.createElement('div');
|
|
root.appendChild(correctNode);
|
|
document.body.appendChild(root);
|
|
var noChild = document.createElement('div');
|
|
document.body.appendChild(noChild);
|
|
|
|
shouldBe("root.querySelector('div')", "correctNode");
|
|
shouldBe("root.querySelectorAll('div').length", "1");
|
|
shouldBe("root.querySelectorAll('div').item(0)", "correctNode");
|
|
|
|
shouldBeNull("noChild.querySelector('div')");
|
|
shouldBe("noChild.querySelectorAll('div').length", "0");
|
|
</script>
|
|
<script src="../../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|