Skip to content

Selection updates for parallel APIs ff125#23013

Merged
Elchi3 merged 5 commits intomdn:mainfrom
hamishwillee:selection_updates_ff125
May 28, 2024
Merged

Selection updates for parallel APIs ff125#23013
Elchi3 merged 5 commits intomdn:mainfrom
hamishwillee:selection_updates_ff125

Conversation

@hamishwillee
Copy link
Copy Markdown
Contributor

@hamishwillee hamishwillee commented May 6, 2024

FF126 adds Selection.getComposedRanges() in nightly, but it also adds some updates to existing APIs:

  • Selection.getComposedRanges()
    • can return multiple ranges, but only in firefox. Spec expects returning 1 range at the moment.
    • Added an URL to docs (still being written)
  • Selection.setBaseAndExtent() - this will now accept anchorNode and focusNode arguments that reside in different shadow trees, which will set the selection accordingly.
  • Selection.collapse() - can now accept a node in any tree, and will collapse the range to that Node.
  • extend() - This should work as-expected, even if the new focusNode is in a different shadow tree.

There are other features coming but that is what is in now (according to https://bugzilla.mozilla.org/show_bug.cgi?id=1867058#c31)

FYI another thing that I don't know how to capture in BCD. I don' think I will:

User selection via mouse, keyboard, etc. - The selection generated by this activity should be allowed to start and end anywhere in the document, including inside any open or closed shadow trees. The behavior should be equivalent to calls to setBaseAndExtent(), modulo canonicalization behavior.

Related work can be tracked in mdn/content#33180

@github-actions github-actions Bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label May 6, 2024
@hamishwillee hamishwillee changed the title Selection updates ff125 Selection updates for parallel APIs ff125 May 6, 2024
Comment thread api/Selection.json Outdated
Comment thread api/Selection.json Outdated
Comment thread api/Selection.json Outdated
Comment thread api/Selection.json Outdated
Comment thread api/Selection.json
},
"status": {
"experimental": true,
"standard_track": false,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, spec only requires returning one range.

@hamishwillee hamishwillee force-pushed the selection_updates_ff125 branch from b63d80f to a9d8204 Compare May 6, 2024 23:15
@hamishwillee hamishwillee marked this pull request as ready for review May 6, 2024 23:15
@dipikabh dipikabh requested a review from queengooborg May 16, 2024 19:25
@dipikabh
Copy link
Copy Markdown
Contributor

Hi @queengooborg, would it be possible for you to review this PR?

@queengooborg
Copy link
Copy Markdown
Contributor

Hi @dipikabh, this is on my review queue already. No need to ping me after marking me for review. :)

Copy link
Copy Markdown
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hamishwillee, looks reasonable to me. 👍

@Elchi3 Elchi3 merged commit 7962ae8 into mdn:main May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants