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

Unified Diff: LayoutTests/fast/dom/shadow/shadow-tree-styles-select-host.html

Issue 208933006: Only :host and :ancestor should ever match the host in a ShadowRoot (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a test for :first-child too Created 6 years, 9 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/shadow-tree-styles-select-host.html
diff --git a/LayoutTests/fast/dom/shadow/shadow-tree-styles-select-host.html b/LayoutTests/fast/dom/shadow/shadow-tree-styles-select-host.html
index 5fe188299cf0657a6a1bd84e083ef575a64adb85..184342a8775e81b59c40f5f268fa3f42dcc3a806 100644
--- a/LayoutTests/fast/dom/shadow/shadow-tree-styles-select-host.html
+++ b/LayoutTests/fast/dom/shadow/shadow-tree-styles-select-host.html
@@ -63,7 +63,7 @@ shouldHaveBorderColor('host-child', 'rgb(0, 0, 0)');
cleanUp();
-debug('Test that :not(*) in a shadow tree can match without :host.');
+debug('Test that :not(*) in a shadow tree cannot match without :host.');
sandbox.appendChild(
createDOM('div', {'id': 'host'},
@@ -74,11 +74,26 @@ sandbox.appendChild(
createDOM('div', {'id': 'host-child'},
document.createTextNode('Hello, Host!'))));
-shouldHaveBorderColor('host', 'rgb(0, 128, 0)');
+shouldHaveBorderColor('host', 'rgb(0, 0, 0)');
shouldHaveBorderColor('host-child', 'rgb(0, 0, 0)');
cleanUp();
+debug('Test that :first-child in a shadow tree cannot match without :host.');
+
+sandbox.appendChild(
+ createDOM('div', {'id': 'host'},
+ createShadowRoot(
+ createDOM('style', {},
+ document.createTextNode(':first-child { border: 1px solid green; }')),
+ createDOM('content', {})),
+ createDOM('div', {'id': 'host-child'},
+ document.createTextNode('Hello, Host!'))));
+
+shouldHaveBorderColor('host', 'rgb(0, 0, 0)');
+
+cleanUp();
+
debug('Test that styles in a containing treescope wins if specificities are the same.');
sandbox.appendChild(

Powered by Google App Engine
This is Rietveld 408576698