Index: LayoutTests/fast/dom/SelectorAPI/duplicate-id-scope.html |
diff --git a/LayoutTests/fast/dom/SelectorAPI/duplicate-id-scope.html b/LayoutTests/fast/dom/SelectorAPI/duplicate-id-scope.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..408fab8ed492aa41a9da67b84dcebf66384d496f |
--- /dev/null |
+++ b/LayoutTests/fast/dom/SelectorAPI/duplicate-id-scope.html |
@@ -0,0 +1,29 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../../resources/js-test.js"></script> |
+</head> |
+<body> |
+ <span id="duplicateId1"></span> |
+ <span id="duplicateId1"></span> |
+ <span id="duplicateId2"></span> |
+ <span id="duplicateId2"></span> |
+ <div id="scopeDiv"> |
+ <span id="duplicateId1"></span> |
+ <span id="duplicateId1"></span> |
+ <span id="duplicateId1"></span> |
+ <span id="duplicateId1"></span> |
+ </div> |
+ <script> |
+ description("Test that CSS selector queries on duplicate Ids respect scope."); |
+ |
+ shouldBe("document.querySelectorAll('#duplicateId1').length", "6"); |
+ shouldBe("document.querySelectorAll('#duplicateId2').length", "2"); |
+ |
+ scopeDiv = document.getElementById("scopeDiv"); |
+ shouldBe("scopeDiv.querySelectorAll('#duplicateId1').length", "4"); |
+ shouldBeNull("scopeDiv.querySelector('#duplicateId2')"); |
+ shouldBe("scopeDiv.querySelectorAll('#duplicateId2').length", "0"); |
+ </script> |
+</body> |
+</html> |