Re: [w3c/selection-api] Need spec changes to Range and StaticRange to support nodes in different tree? (Issue #169)

An example of the node comparison issue that Emilio pointed

```
<html>
  <body>
    <div>
      <template shadowrootmode="open">
        <span id="inner1">Inner1</span>
        <slot name="one"></slot>
        Inner2
        <slot name="two"></slot>
        Inner3
      </template>
      <span id="FirstElement" slot="two">FirstSlot</span>
      <span id="SecondElement" slot="one">SecondSlot</span>
    </div>
    <script>
      const root = document.querySelector('div').shadowRoot;
      window.getSelection().setBaseAndExtent(document.body, 0, SecondElement, SecondElement.childNodes.length);
      console.log(window.getSelection().getRangeAt(0).isPointInRange(FirstElement, 0));
    </script>
  </body>
</html>
```

The above console.log prints true, saying FirstElement is in the range, however it's not visually selected. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/169#issuecomment-2023179494
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/selection-api/issues/169/2023179494@github.com>

Received on Wednesday, 27 March 2024 16:19:49 UTC