Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,28 @@
<div id="pseudo-2"></div>
</div>

<div id="named-host-to-slotted">
<template shadowrootmode="open">
<style>
:host {
container: --host-container / inline-size;
}
</style>
<slot></slot>
</template>
<div id="host-slotted-named">
<template shadowrootmode="open">
<style>
@container --host-container (width >= 0) {
:host {
color: green;
}
}
</style>
</template>
</div>
</div>

<script>
setup(() => {
assert_implements_size_container_queries();
Expand Down Expand Up @@ -481,4 +503,9 @@
const target = document.querySelector("#pseudo-2");
assert_equals(getComputedStyle(target, "::before").color, green);
}, "Search flat tree anchestors of the originating element of ::before");

test(() => {
const target = document.querySelector("#host-slotted-named");
assert_equals(getComputedStyle(target).color, green);
}, "Parent container name and style on :host, with query set on slotted child's :host");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,29 @@
</div>
</div>

<div id="named-host-to-slotted">
<template shadowrootmode="open">
<style>
:host {
--foo: baz;
container-name: --host-container;
}
</style>
<slot></slot>
</template>
<div id="host-slotted-named">
<template shadowrootmode="open">
<style>
@container --host-container style(--foo: baz) {
:host {
color: green;
}
}
</style>
</template>
</div>
</div>

<script>
setup(() => {
assert_implements_style_container_queries();
Expand Down Expand Up @@ -257,4 +280,9 @@
assert_equals(getComputedStyle(t12).color, green);
}, "A :host::part rule matching a container in the shadow tree");

test(() => {
const target = document.querySelector("#host-slotted-named");
assert_equals(getComputedStyle(target).color, green);
}, "Parent container name and style on :host, with query set on slotted child's :host");

</script>