Re: [dom] Consider banning insertNode() of the Range's start node (#63)

This is very timely. Edge recently started failing a WPT range test due to a change we made to exit early from an insertNode operation when we detect the same node will be inserted in the same place at the start of the node (and we failed up update the range boundary points after splitting the text).

Given @ayg proposal above, I reviewed these principles with the team, who are strongly in agreement. In summary, we would definitely prefer to have the rules of DOM reject certain pointless operations, as the cost of an implicit split such as that caused in the above example have downstream performance impact via all the notifications that must be sent to update layout, collections, etc. We suspect that the web compat impact for making these change is minimal given Chrome currently throws under these conditions.

Principle 1 is great. We can consider it a bug any time an *implicit* split happens without inserting something in between.

I wonder if Principle 2 can be generalized a bit more. For example, does it ever make sense to insert a node from the context node's inclusive ancestry or vice-versa (where the node to be inserted is an inclusive descendent of the context node)? Should this apply to other operations besides insertNode? (e.g., ```replaceWith``` might be able to avoid some remove/insert combinations when it operates on itself)? Or is this taking the restriction too far?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/63#issuecomment-138713823

Received on Tuesday, 8 September 2015 21:48:57 UTC