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

More thorough test-case:

```html
<!doctype html>
foo
<script>
var range = document.createRange();
range.setStart(document.body.firstChild, 1);
var s = "Body children before: " + document.body.childNodes.length;
try {
  range.insertNode(range.startContainer);
  document.body.textContent = s + ", after: " + document.body.childNodes.length + ".  Range: (" + range.startContainer.nodeName + " " + range.startOffset + ", " + range.endContainer.nodeName + " " + range.endOffset + ").";
} catch (e) {
  document.body.textContent = "Exception";
}
</script>
```

Firefox outputs "Body children before: 2, after: 3. Range: (BODY 0, BODY 2)."  This is what you'd expect: both text nodes selected.  Same if offset is changed from 1 to 0.  IE outputs "Body children before: 2, after: 3. Range: (#text 0, BODY 2).", which is basically equivalent to Firefox.  But if you change the offset to 0, IE gives "Body children before: 2, after: 2. Range: (#text 0, #text 4)." -- so it selects the inserted node, it doesn't abort silently.  Presumably it has a special case to avoid splitting a text node at the start or end, which sounds like a good idea in general!  I'll file a separate issue for that.

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

Received on Tuesday, 11 August 2015 18:15:28 UTC