Range.extractContents() and Range.surroundContents() describe behaviour incorrectly #35854
Labels
Content:WebAPI
Web API docs
help wanted
If you know something about this topic, we would love your help!
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/Range/extractContents
(Also https://developer.mozilla.org/en-US/docs/Web/API/Range/surroundContents)
What specific section or headline is this issue about?
No response
What information was incorrect, unhelpful, or incomplete?
Both pages describe:
This is not the behaviour as far as I can see in 126.0.6478.214 (Official Build) (64-bit), if a text node is the startContainer or endContainer or both. And is not the intended behaviour according to the spec:
(Unsure why that doesn't also apply to elements, but there you go.)
A range that is "partial" through text nodes (even if the offsets are at the beginning and end of the text nodes in question) will be cloned. They are not the original nodes. As such, they are not "moved." And that is the intended and correct behaviour. Therefore, the wording in the reference page is misleading at best or just wrong.
The closest I see to any explanation of this is in the extractContents() page:
Which does not explain the definition of a "partially selected node" which is a misleading term anyway. In practise, the usage on the extractContents() page means "if a text node is the starting or ending boundary node." Whether or not all of that text node is included in the range.
And does not always have anything to do with parent tags. In fact, I've not been able to see any case in my testing where the parent tag is cloned. Maybe they are "included", but that term is not explained either and I cannot figure out what is meant by it.
What did you expect to see?
An accurate description of the behaviour, without unexplained terms, or with such terms properly explained:
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
The text was updated successfully, but these errors were encountered: