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

> We could do that but then we may need to indicate that those end points either start before/after the root or not. Some components may not want to do anything unless the entirety of the selection resides within; e.g. text editor. If the user selected the entire document, the component may need to differentiate that from when the user selected everything in the component.

This is a good point. Any thoughts on how to communicate that? Augment `StaticRange` with another two boolean fields to indicate whether each endpoint has been "re-written"?


> Perhaps. We probably still want to allow a list of shadow roots as well so that scripts can "see" the entire selection when there are multiple components that coordinate with one another when the user selects content across shadow boundaries. e.g. table cells / rows.

Right, I was thinking something like this:

```webIDL
partial interface Selection {
  StaticRange getComposedRange(optional GetComposedRangeOptions options = {});
};

dictionary GetComposedRangeOptions {
  Node selectionRoot;
  sequence<ShadowRoot> shadowRoots;
};
```

... you can specify `selectionRoot` and/or `shadowRoots`. Specifying `selectionRoot` automatically adds `selectionRoot.getRootNode()` to `shadowRoots`.

-- 
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-962013007

Received on Friday, 5 November 2021 15:57:24 UTC