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.
Related to https://github.com/whatwg/dom/issues/772
Currently, Chrome and Firefox returns mutable reference of
Range
object fromSelection.getRangeAt()
. Then, theRange
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 theSelection
because this kind of checks are done atSelection.addRange()
at least.Cc: @sefeng211, @smaug----, @zcorpan