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

Unified Diff: LayoutTests/fast/dom/shadow/hostcontext-pseudo-class.html

Issue 212513002: :host-context should support functional notation only. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added test for invalid :host-context. 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/hostcontext-pseudo-class-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/shadow/hostcontext-pseudo-class.html
diff --git a/LayoutTests/fast/dom/shadow/hostcontext-pseudo-class.html b/LayoutTests/fast/dom/shadow/hostcontext-pseudo-class.html
index 22cfae28a77ed9359d91d2992e3b7f8b2e4a13e4..e36161fd7e9f2f6337a11cc806651bdf2586ddcb 100644
--- a/LayoutTests/fast/dom/shadow/hostcontext-pseudo-class.html
+++ b/LayoutTests/fast/dom/shadow/hostcontext-pseudo-class.html
@@ -4,7 +4,7 @@
<script src="../../../resources/js-test.js"></script>
<script src="resources/shadow-dom.js"></script>
<style>
-:host-context {
+:host-context(*) {
background-color: red;
}
</style>
@@ -49,7 +49,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode('*:host-context { background-color: green; }')),
+ document.createTextNode('*:host-context(*) { background-color: red; }')),
createDOM('div', {},
document.createTextNode('Hello')))));
@@ -63,7 +63,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode('div:host-context { background-color: green; }')),
+ document.createTextNode('div:host-context(*) { background-color: red; }')),
createDOM('div', {},
document.createTextNode('Hello')))));
@@ -77,7 +77,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host', 'class': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode('.host:host-context { background-color: green; }')),
+ document.createTextNode('.host:host-context(*) { background-color: red; }')),
createDOM('div', {},
document.createTextNode('Hello')))));
@@ -91,7 +91,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode('#host:host-context { background-color: green; }')),
+ document.createTextNode('#host:host-context(*) { background-color: red; }')),
createDOM('div', {},
document.createTextNode('Hello')))));
@@ -105,7 +105,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host', 'foo': 'bar'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode('[foo=bar]:host-context { background-color: green; }')),
+ document.createTextNode('[foo=bar]:host-context(*) { background-color: red; }')),
createDOM('div', {},
document.createTextNode('Hello')))));
@@ -164,7 +164,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host2'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode(':host-context { background-color: green; }')),
+ document.createTextNode(':host-context(*) { background-color: green; }')),
createDOM('div', {},
document.createTextNode('Hello')))))));
@@ -263,13 +263,13 @@ sandbox.appendChild(
createDOM('div', {'id': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode(':host-context(div:host-context, div#sandbox) { background-color: green; }')),
+ document.createTextNode(':host-context(div:host-context(*), div#sandbox) { background-color: green; }')),
createDOM('style', {},
document.createTextNode(':host-context(body.mytheme) { background-color: red; }')),
createDOM('div', {},
document.createTextNode('Hello')))));
-// :host-context(div:host-context, div#sandbox) wins, because div#sandbox > body.mytheme.
+// :host-context(div:host-context(*), div#sandbox) wins, because div#sandbox > body.mytheme.
backgroundColorShouldBe('host', 'rgb(0, 128, 0)');
cleanUp();
@@ -278,13 +278,13 @@ sandbox.appendChild(
createDOM('div', {'id': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode(':host-context(div:host-context, div#nomatch) { background-color: green; }')),
+ document.createTextNode(':host-context(div:host-context(*), div#nomatch) { background-color: green; }')),
createDOM('style', {},
document.createTextNode(':host-context(body.mytheme) { background-color: red; }')),
createDOM('div', {},
document.createTextNode('Hello')))));
-// :host-context(body.mytheme) wins, because div:host-context < body.mytheme.
+// :host-context(body.mytheme) wins, because div:host-context(*) < body.mytheme.
backgroundColorShouldBe('host', 'rgb(255, 0, 0)');
cleanUp();
@@ -294,7 +294,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode(':host-context(div:host-context, div#host:host-context) > div { background-color: green; }')),
+ document.createTextNode(':host-context(div:host-context(*), div#host:host-context(*)) > div { background-color: green; }')),
createDOM('style', {},
document.createTextNode(':host-context(body.mytheme) > div { background-color: red; }')),
createDOM('div', {'id': 'target'},
@@ -308,7 +308,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host', 'class': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode(':host-context(div:host-context, div#host.host:host-context) > div { background-color: green; }')),
+ document.createTextNode(':host-context(div:host-context(*), div#host.host:host-context(*)) > div { background-color: green; }')),
createDOM('style', {},
document.createTextNode(':host-context(body) > div#target { background-color: red; }')),
createDOM('div', {'id': 'target'},
@@ -322,7 +322,7 @@ sandbox.appendChild(
createDOM('div', {'id': 'host', 'class': 'host'},
createShadowRoot(
createDOM('style', {},
- document.createTextNode(':host-context(div:host-context(div:host-context(div:host-context(div:host-context)))) > div { background-color: green; }')),
+ document.createTextNode(':host-context(div:host-context(div:host-context(div:host-context(div:host-context(*))))) > div { background-color: green; }')),
createDOM('style', {},
document.createTextNode(':host-context(div) > div { background-color: red; }')),
createDOM('div', {'id': 'target'},
@@ -332,5 +332,19 @@ backgroundColorShouldBe('host/target', 'rgb(0, 128, 0)');
cleanUp();
+debug(':host-context without functional notation should not match any shadow hosts.');
+
+sandbox.appendChild(
+ createDOM('div', {'id': 'host'},
+ createShadowRoot(
+ createDOM('style', {},
+ document.createTextNode(':host-context { background-color: red; }')),
+ createDOM('div', {},
+ document.createTextNode('Hello')))));
+
+backgroundColorShouldBe('host', 'rgba(0, 0, 0, 0)');
+
+cleanUp();
+
</script>
</body>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/hostcontext-pseudo-class-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698