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> |