Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-anchor-position/position-try-tree-scoped-pseudo.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<link rel="author" title="David Shin" href="mailto:dshin@mozilla.com">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
#host {
position: relative;
}
.foo {
width: 100px;
height: 100px;
background: red;
}
.foo::after {
display: block;
width: 100px;
height: 100px;
content: "";
background: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="host">
<template shadowrootmode="open">
<style>
@position-try --host-slot-part {
left: 0px;
}
::slotted(.foo)::after {
position: absolute;
left: 999999px;
position-try-fallbacks: --host-slot-part;
}
</style>
<div id="part" part="part"></div>
<slot></slot>
</template>
<div class=foo></div>
</div>