Re: [csswg-drafts] [cssom-view] Specify document.caretPositionFromPoint in shadow DOM scenario (#9932)

So in my opinion, the Gecko approach should definitely not be put in the spec. It trivially reveals shadow root contents, including for closed roots, which is very bad:

```
<!DOCTYPE html>
<div>
  <template shadowrootmode=closed>
    <div style="width:300px;height:300px;background:lightblue">
      Oops
    </div>
  </template>
</div>
<script>
  const str = document.caretPositionFromPoint(100,100).offsetNode.textContent;
  document.body.append(str)
</script>
```

I'd +1 the comments above that this should follow the behavior of `getComposedRanges()`:

- https://w3c.github.io/selection-api/#dom-selection-getcomposedranges

@annevk @rniwa 

-- 
GitHub Notification of comment by mfreed7
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9932#issuecomment-2035004366 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 3 April 2024 16:00:54 UTC