Re: [WICG/webcomponents] Selection APIs for Shadow DOM (#79)

My 2 cents as a maintainer of Quill fork which has to deal with Safari encapsulation (see https://github.com/vaadin/quill/pull/2).

In case of rich text editor component, a shadow root is typically known in advance, some example:

```js
this.rootDocument = (this.root.getRootNode ? this.root.getRootNode() : document);
// get selection
const selection = this.rootDocument.getSelection();
```

Then there is a relatively small [polyfill](https://github.com/vaadin/quill/blob/1cfe24900a5b402616b93f4a6bcafc61608c4e02/core/shadow-selection-polyfill.js) for `getSelection()`.

The question is: would this use case be possible to achieve by using proposed `getComposedRange(rootDocument)`?
Please correct me if I'm wrong, but the answer seems to be "yes". So I'm fine with what @rniwa suggests.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/79#issuecomment-937518617

Received on Thursday, 7 October 2021 07:13:55 UTC