Index: LayoutTests/fast/selectors/element-closest-scope.html |
diff --git a/LayoutTests/fast/selectors/element-closest-scope.html b/LayoutTests/fast/selectors/element-closest-scope.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..68f9cb095d55b7620315429a440f94613d8b0f3f |
--- /dev/null |
+++ b/LayoutTests/fast/selectors/element-closest-scope.html |
@@ -0,0 +1,46 @@ |
+<!doctype html> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+if (window.testRunner) |
+ testRunner.dumpAsText(); |
+</script> |
+</head> |
+<body> |
+ <sibling></sibling> |
+ <target id="theTarget" webkit="fast"></target> |
+</body> |
+<script> |
+description('This test makes sure that :scope works correctly with the closest() API.'); |
+ |
+var theTarget = document.getElementById('theTarget'); |
+var body = document.body; |
+ |
+shouldBe('theTarget.closest(":scope")', 'theTarget'); |
+shouldBe('theTarget.closest(":not(:scope)")', 'body'); |
+ |
+shouldBe('theTarget.closest("body :scope")', 'theTarget'); |
+shouldBe('theTarget.closest("body > :scope")', 'theTarget'); |
+shouldBeNull('theTarget.closest("body:scope")'); |
+ |
+shouldBe('theTarget.closest("sibling + :scope")', 'theTarget'); |
+shouldBe('theTarget.closest("sibling ~ :scope")', 'theTarget'); |
+ |
+shouldBe('theTarget.closest("#theTarget:scope")', 'theTarget'); |
+shouldBe('theTarget.closest(":scope#theTarget")', 'theTarget'); |
+ |
+shouldBe('theTarget.closest("[webkit]:scope#theTarget")', 'theTarget'); |
+shouldBeNull('theTarget.closest(":not([webkit=fast]):scope#theTarget")'); |
+ |
+shouldBeNull('theTarget.closest(":scope target")'); |
+shouldBeNull('theTarget.closest(":scope > target")'); |
+shouldBeNull('theTarget.closest(":scope + target")'); |
+shouldBeNull('theTarget.closest(":scope ~ target")'); |
+ |
+shouldBeNull('theTarget.closest(":scope *")'); |
+shouldBeNull('theTarget.closest(":scope > *")'); |
+shouldBeNull('theTarget.closest(":scope + *")'); |
+shouldBeNull('theTarget.closest(":scope ~ *")'); |
+</script> |
+</html> |