Re: [whatwg/dom] Should a Range object be able to update a Selection object (#772)

Yes, there are extensive mutation [WPT tests](https://wpt.fyi/results/dom/ranges?label=master&label=experimental&aligned&q=dom%2Franges%2Frange-mutations-) and all browsers are passing 100%. Note all these don't test shadow trees cases.

I agree. The spec and implementation says the live range should be reflected on the selection. We should make decisions with that as a guiding principle. I also think option A is reasonable. Users modifying a live range should only be able to modify within its tree scope. Beyond that, they should consider using Selection's collapse() and extend().

> B seems reasonable, though I wonder what the Selection API returns? The same as getRangeAt()?
Yes, the same as getRangeAt(). For this example, both Blink and Gecko has:
The live range has start{innerHost.firstChild, 5} and end{innerHost.firstChild, 6}
The Selection has anchor{innerHost.firstChild, 5} and focus{innerHost.firstChild, 6}

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/772#issuecomment-2504716465
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/772/2504716465@github.com>

Received on Wednesday, 27 November 2024 20:25:01 UTC