Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: LayoutTests/fast/selectors/query-update-distribution.html

Issue 1153873004: Handle ::content and :host-context correctly in SelectorQuery. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No really, the right patch. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/selectors/query-update-distribution.html
diff --git a/LayoutTests/fast/selectors/query-update-distribution.html b/LayoutTests/fast/selectors/query-update-distribution.html
new file mode 100644
index 0000000000000000000000000000000000000000..ed40f4732f8dc64a43d867d9437773ceaae912b0
--- /dev/null
+++ b/LayoutTests/fast/selectors/query-update-distribution.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+
+<div id="target">
+ <div id="a">
+ <div id="b"></div>
+ </div>
+</div>
+
+<script>
+description("Should update distribution when needed for querySelector and related methods.");
+
+var target = document.getElementById("target");
+var a = document.getElementById("a");
+
+var targetRoot = target.createShadowRoot();
+targetRoot.innerHTML = "<div id=c><content></content></div>";
+var c = targetRoot.getElementById("c");
+
+var aRoot = a.createShadowRoot();
+aRoot.innerHTML = "<div id=d></div>";
+var d = aRoot.getElementById("d");
+
+shouldBe("aRoot.querySelector(':host-context(#c) #d')", "d");
+// This does actually match #a, but it's in the wrong scope.
+shouldBeNull("targetRoot.querySelector('::content #a')");
+shouldBeFalse("a.matches('::content #a')");
+shouldBeTrue("d.matches(':host-context(#target) #d')");
+shouldBeTrue("d.matches(':host-context(#c) #d')");
+shouldBeNull("b.closest('::content #a')");
kochi 2015/05/25 11:07:04 Hopefully, we have 3 separate cases, 1. createSha
esprehn 2015/05/25 20:52:26 Updated the test to dirty between each test and ad
+</script>

Powered by Google App Engine
This is Rietveld 408576698