Bug 16766
Summary: | DOM Range doesn't correctly update when modifying contents (Acid3) | ||
---|---|---|---|
Product: | WebKit | Reporter: | Andrew Wellington <andrew> |
Component: | New Bugs | Assignee: | Darin Adler <darin> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | justin.garcia |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
Andrew Wellington
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;
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Eric Seidel (no email)
ccing justin since he lives in the editing code so much.
Eric Seidel (no email)
actually, I meant to CC justin on the one that I'd solved, not the one I was about to solve. :)
Darin Adler
*** This bug has been marked as a duplicate of 11997 ***