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

So here's the code that throws in Blink in the test case from https://github.com/whatwg/dom/issues/63#issuecomment-130000751

```C++
    for (Node* n = m_start.container(); n; n = n->parentNode()) {
        if (n == newNode) {
            exceptionState.throwDOMException(HierarchyRequestError, "The node to be inserted contains the insertion point; it may not be inserted into itself.");
            return;
        }
    }
```

In other words, being a text node isn't relevant here, if the start node of the range is an element, the same thing happens. Also note the traversal of parents of the start node.

(There's another `HierarchyRequestError` that seems to match the spec's "is a Text node whose parent is null" condition, and yet more still that I'm not sure about.)

Is the IE/Gecko behavior really exactly what the spec said before this change, or is it actually a mess as well?

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

Received on Thursday, 8 October 2015 11:50:19 UTC