The current implementation of the DOM Range is not compatible with other browsers or previous versions of WebKit. If you test the attached test case in Safari 3, FF 3, Opera 9 it will only fail on one point the cloneContents but on the latest WebKit it fails on both extractContents and deleteContents. If you run the same tests on the latest nightly of FF and the latest build of Opera it will pass all tests so the attached test case is compatible to the spec or at least to the latest implementations by other browser vendors.
Created attachment 27917 [details] Test case for the DOM Range implementation Run this test file in latest WebKit.
Check the URL not the attached file since it requests things using https and it fails from https.
Confirmed that the test passes in Safari/WebKit 3.2.1 and in Minefield, but fails in r41181.
<rdar://problem/6674179>
Created attachment 28771 [details] proposed fix I couldn't find any remnants of code that could make this work, so it's surprising that this is a regression. Perhaps this code was removed in hopes that Document::textRemoved() would automatically take care of fixing the range? It does not, and it is not supposed to - I've verified that a range that's equal to the one that deleteContents is invoked on ends up being different from it in Firefox: var range1 = something var range2 = the same range1.deleteContents() // Both ranges are fixed, but differently - range1 is always collapsed, but range2 may not be.
Comment on attachment 28771 [details] proposed fix r=me I was probably the one who broke this. Thanks for fixing it!
*** Bug 24677 has been marked as a duplicate of this bug. ***
Committed <http://trac.webkit.org/changeset/41855>.
*** Bug 24896 has been marked as a duplicate of this bug. ***