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

Steps of removing a node definition about live range do not match with browsers if the range is in a shadow DOM and the shadow itself is removed #1274

Open
masayuki-nakano opened this issue Apr 4, 2024 · 2 comments

Comments

@masayuki-nakano
Copy link

What is the issue with the DOM Standard?

https://dom.spec.whatwg.org/#concept-node-remove

  1. For each live range whose start node is an inclusive descendant of node, set its start to (parent, index).
  2. For each live range whose end node is an inclusive descendant of node, set its end to (parent, index).

"inclusive descendant" is defined as:
https://dom.spec.whatwg.org/#concept-tree-inclusive-descendant

An object A is called a descendant of an object B, if either A is a child of B or A is a child of an object C that is a descendant of B.
An inclusive descendant is an object or one of its descendants.

Although the latter definition does not mention about shadow DOM boundaries, these definitions sound like that when a shadow containing a live range is deleted, the range is collapsed at the removed node position in the parent (or ancestor) tree. I wrote a test for this and now merged into the WPT tree that expects that Range is not collapsed to outside the shadow DOM tree. Then, all browsers now pass all tests.

So I think that the former definition should mention about that when the live range is in a subtree, removable of inclusive ancestor of the host does not affect to the range.

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

@annevk
Copy link
Member

annevk commented Apr 9, 2024

cc @mfreed7 @domfarolino

@smaug----
Copy link
Collaborator

See also w3c/selection-api#168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants