Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            - /selection/cross-shadow-boundary-slot-in-nested-shadow-dom.html - WPT Dashboard Interop Dashboard
 
<!doctype html>
<head>
<link rel="match" href="cross-shadow-boundary-slot-in-nested-shadow-dom-ref.html"/>
</head>
<span id="outer">Outer</span>
<div id="host">
  <template shadowrootmode="open">
    <span id="inner">Inner</span>
    <div id="innerHost">
      <template shadowrootmode="open">
      <span id="inner">Inner2</span>
      <slot></slot>
      </template>
      <span id="slotted">Slotted</span>
    </div>
  </template>
</div>
<script>
  // This selects:
  // er
  // Inner
  // Inner2 Slott
  const slotted = host.shadowRoot.getElementById("slotted");
  window.getSelection()
      .setBaseAndExtent(outer.firstChild, 3, slotted.firstChild, 5);
</script>