This is related to http://bugs.webkit.org/show_bug.cgi?id=16764 but applies to changing the contents of the range not using the range API, but just directly messing with the DOM that contains the range. Test 16: FAIL (collapsed is wrong after deletion) // test 16: Ranges under mutations: deletion var doc = getTestDocument(); var p = doc.createElement('p'); p.appendChild(doc.createTextNode("12345")); doc.body.appendChild(p); var r = doc.createRange(); r.setEnd(doc.body, 1); r.setStart(p.firstChild, 2); assert(!r.collapsed, "collapsed is wrong at start"); assertEquals(r.commonAncestorContainer, doc.body, "commonAncestorContainer is wrong at start"); assertEquals(r.startContainer, p.firstChild, "startContainer is wrong at start"); assertEquals(r.startOffset, 2, "startOffset is wrong at start"); assertEquals(r.endContainer, doc.body, "endContainer is wrong at start"); assertEquals(r.endOffset, 1, "endOffset is wrong at start"); doc.body.removeChild(p); assert(r.collapsed, "collapsed is wrong after deletion"); assertEquals(r.commonAncestorContainer, doc.body, "commonAncestorContainer is wrong after deletion"); assertEquals(r.startContainer, doc.body, "startContainer is wrong after deletion"); assertEquals(r.startOffset, 0, "startOffset is wrong after deletion"); assertEquals(r.endContainer, doc.body, "endContainer is wrong after deletion"); assertEquals(r.endOffset, 0, "endOffset is wrong after deletion"); return 1;
ccing justin since he lives in the editing code so much.
actually, I meant to CC justin on the one that I'd solved, not the one I was about to solve. :)
*** This bug has been marked as a duplicate of 11997 ***