Bugzilla – Bug 15325
splitText() and replace data both modify ranges
Last modified: 2011-12-28 18:26:39 UTC
The splitText() method and the replace data algorithm both modify ranges and since splitText() uses replace data this creates a conflict of sorts. This will also be problematic for mutation listeners I think.
As discussed in #whatwg, recorded here for convenience:
[111228 13:07:13] <AryehGregor> annevk, is there some reason we don't want splitting a text node to add the new text node before replacing data? If we did that, it would be easy to avoid the problems caused by both splitting and replacing data modifying ranges.
[111228 13:07:36] <AryehGregor> Just modify them in the split algorithm before removing the data.
[111228 13:07:55] <AryehGregor> Then when you do the replace data, there will be no boundary points in the replaced data, so nothing will change.
[111228 13:10:42] <annevk> I guess the MutationRecord order would change
[111228 13:10:56] <annevk> But basically I do not know
[111228 13:11:20] <AryehGregor> I think I cheated when I did it by saying "except when called by splitText", but that's lame.
[111228 13:11:27] <AryehGregor> Should I change the split algorithm accordingly?
[111228 13:12:10] <annevk> AryehGregor: yeah we can change it for now, but add a note that this needs to be tested when the new world order arrives