Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Define to remove selection range automatically if a selection range is modified into different selection root

Open
#175 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
html
Domain
frontend

Research direction

Start with the Selection API definition of Selection.addRange() and the referenced Web Platform Test, selection/move-selection-range-into-different-root.tentative.html. Compare the test behavior with the issue's proposed invariant for ranges moved to another root, and review the related DOM issue. Done when the specification defines the behavior and the relevant test reflects it.

Written by the indexing model from the issue text.

Description

Related to https://github.com/whatwg/dom/issues/772

Currently, Chrome and Firefox returns mutable reference of Range object from Selection.getRangeAt(). Then, the Range can be updated outside the DOM tree, e.g., into a different document, into a disconnected tree. I wrote a test, then, both Chrome and Firefox get same result.

I believe that Selection should not keep storing a range whose boundary points' root is not the document associated with the Selection because this kind of checks are done at Selection.addRange() at least.

Cc: @sefeng211, @smaug----, @zcorpan

Dominant language
HTML
Stars
49
Forks
30
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from w3c/selection-api

All issues in w3c/selection-api

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.