Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection API: getComposedRanges #376

Closed
dizhang168 opened this issue Jul 26, 2024 · 2 comments
Closed

Selection API: getComposedRanges #376

dizhang168 opened this issue Jul 26, 2024 · 2 comments
Labels
from: Google Proposed, edited, or co-edited by Google. position: support topic: editing Spec relates to text editing venue: W3C Web Editing WG

Comments

@dizhang168
Copy link

dizhang168 commented Jul 26, 2024

WebKittens

@annevk @rniwa @whsieh

Title of the spec

Selection API: getComposedRanges()

URL to the spec

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

URL to the spec's repository

https://github.com/w3c/selection-api

Issue Tracker URL

No response

Explainer URL

https://github.com/mfreed7/shadow-dom-selection

TAG Design Review URL

No response

Mozilla standards-positions issue URL

mozilla/standards-positions#1055

WebKit Bugzilla URL

https://bugs.webkit.org/show_bug.cgi?id=251997

Radar URL

No response

Description

Current getComposedRanges API has single shadowRoots parameter which is a rest parameter. We propose changing it to a dictionary that contains an array of shadow roots to be consistent with other shadow DOM API:

We would also like to add selectionRoot. This argument "scopes" the selection, so that the returned selection endpoints are always descendants of element.

Proposed change:

sequence<StaticRange> getComposedRanges(optional GetComposedRangesOptions options = {});

dictionary GetComposedRangesOptions {
  sequence<ShadowRoot> shadowRoots = [];
  Node? selectionRoot = null;
};

Further, we need to re-evaluate API changes for the Range and StaticRange interface, to support nodes in different tree. Either we need to update existing definitions or we might need to add new interfaces. Help us resolve these discussions.

See:
Changes to Range, StaticRange: w3c/selection-api#169
Change getComposedRanges’ parameter to a dictionary: w3c/selection-api#176
Change getComposedRanges to have selectionRoot parameter: w3c/selection-api#180
Main: w3c/selection-api#161

@dizhang168 dizhang168 changed the title Change Selection getComposedRanges's shadowRoots parameter from rest parameter to a dictionary Selection API: getComposedRanges Aug 2, 2024
@annevk annevk added topic: editing Spec relates to text editing venue: W3C Web Editing WG labels Aug 20, 2024
@rniwa
Copy link
Member

rniwa commented Sep 19, 2024

Making getComposedRanges use a dictionary seems like a reasonable change but there is a possibility we'd hit a web compatibility issue given we've already shipped this API.

@nt1m nt1m added the from: Google Proposed, edited, or co-edited by Google. label Nov 2, 2024
@annevk
Copy link
Contributor

annevk commented Nov 4, 2024

Given rniwa's feedback at TPAC I suggest we mark this as "position: support" one week from now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from: Google Proposed, edited, or co-edited by Google. position: support topic: editing Spec relates to text editing venue: W3C Web Editing WG
Projects
None yet
Development

No branches or pull requests

4 participants