Bug 15325 - splitText() and replace data both modify ranges
Summary: splitText() and replace data both modify ranges
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-23 15:45 UTC by Anne
Modified: 2011-12-28 18:26 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anne 2011-12-23 15:45:07 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.
Comment 1 Aryeh Gregor 2011-12-28 18:26:39 UTC
http://dvcs.w3.org/hg/domcore/rev/c455352a9a14

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