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

Unified Diff: LayoutTests/fast/dom/shadow/style-in-shadow-matches-elements-in-all-sibling-shadows.html

Issue 102953007: Selectors in styles in shadowRoots should match in all of the host's shadowRoots. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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/dom/shadow/style-in-shadow-matches-elements-in-all-sibling-shadows.html
diff --git a/LayoutTests/fast/dom/shadow/style-in-shadow-matches-elements-in-all-sibling-shadows.html b/LayoutTests/fast/dom/shadow/style-in-shadow-matches-elements-in-all-sibling-shadows.html
new file mode 100644
index 0000000000000000000000000000000000000000..76a58b33efcb50abac9f98923bf6f67a8a5de9a1
--- /dev/null
+++ b/LayoutTests/fast/dom/shadow/style-in-shadow-matches-elements-in-all-sibling-shadows.html
@@ -0,0 +1,57 @@
+<!doctype html>
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script src="resources/shadow-dom.js"></script>
+</head>
+<body>
+<div id='sandbox'></div>
+<pre id='console'></pre>
+</body>
+<script>
+function styleOf(selector)
+{
+ return window.getComputedStyle(getNodeInTreeOfTrees(selector));
+}
+
+function cleanUp()
+{
+ document.getElementById('sandbox').innerHTML = '';
+}
+
+description("Test for crbug.com/311717: selectors in styles in shadowRoots should match in all of the host's shadowRoots");
+
+document.getElementById('sandbox').appendChild(
+ createDOM('div', {'id': 'host'},
+ createShadowRoot(
+ createDOM('style', {},
+ document.createTextNode('.foo { background: red; }')),
+ createDOM('div', {'class': 'foo'})),
+ createShadowRoot(
+ createDOM('style', {},
+ document.createTextNode('.foo { color: green; }')),
+ createDOM('div', {'class': 'foo', 'id': 'bar'},
+ document.createTextNode('Hello')))));
+
+shouldBe('styleOf("host//bar").color', '"rgb(0, 128, 0)"');
+shouldBe('styleOf("host//bar").backgroundColor', '"rgb(255, 0, 0)"');
+cleanUp();
+
+document.getElementById('sandbox').appendChild(
+ createDOM('div', {'id': 'host'},
+ createShadowRoot(
+ createDOM('style', {},
+ document.createTextNode('.foo { background: red; } #bar { color: red; }')),
+ createDOM('div', {'class': 'foo'})),
+ createShadowRoot(
+ createDOM('style', {},
+ document.createTextNode('.foo { color: green; }')),
+ createDOM('div', {'class': 'foo', 'id': 'bar'},
+ document.createTextNode('Hello')))));
+
+shouldBe('styleOf("host//bar").color', '"rgb(255, 0, 0)"');
+shouldBe('styleOf("host//bar").backgroundColor', '"rgb(255, 0, 0)"');
+cleanUp();
+
+</script>
+</html>

Powered by Google App Engine
This is Rietveld 408576698