Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-values/calc-sibling-function-in-shadow-dom.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>sibling-index() within Shadow DOM</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="host">
<div>Some element.</div>
<div>Some other element.</div>
<div slot="unknown">This should be ignored.</div>
<div id="target">Some third element.</div>
</div>
<script>
test(() => {
host.attachShadow({mode: 'open'}).innerHTML = `
<style>slot::slotted(*) { z-index: sibling-index(); }</style>
<div>
<div>Some text before the slot.</div>
<slot></slot>
</div>
`;
// The originating element for slot::slotted(*)
// is the <slot>, not the <div>. Note that there is
// a proposal to change this; see
// This should probably become '3' after that is fixed.
assert_equals(getComputedStyle(target).zIndex, '2');
}, 'originating element in Shadow DOM');
</script>