RESOLVED DUPLICATE of bug 2412224677
REGRESSION: Range#surroundContents is inserting empty text nodes into the document
https://bugs.webkit.org/show_bug.cgi?id=24677
Summary REGRESSION: Range#surroundContents is inserting empty text nodes into the doc...
Nick Santos
Reported 2009-03-18 13:17:37 PDT
Repro steps: 1) Create a range over the text "---[ANCHOR]Text to <br/> split[FOCUS]---" 2) Call range.surroundContents(someElement) Results: A 0-length text node is inserted after [FOCUS] This is happening in 528 and 530 on Windows. You can visit http://www.nick-santos.com/tests/webkit_range_test.html for a simple test case. I don't make very good cookies, but Julie says that she will award a cookie to the person that fixes this.
Attachments
further reduced test case (737 bytes, text/html)
2009-03-19 13:13 PDT, Alexey Proskuryakov
no flags
Julie Parent
Comment 1 2009-03-18 13:20:11 PDT
This is definitely a regression, the test passes fine in Chrome 1.0/WebKit 525.
Alexey Proskuryakov
Comment 2 2009-03-19 12:35:06 PDT
Confirmed as a regression.
Alexey Proskuryakov
Comment 3 2009-03-19 13:13:32 PDT
Created attachment 28760 [details] further reduced test case This version works in Firefox, too. The problem is actually in Range.insertNode, which surroundContents uses internally.
Alexey Proskuryakov
Comment 4 2009-03-19 13:23:57 PDT
Err, not quite - it's the range start that's different after extractContents(). It used to be ([object HTMLDivElement], 1), but now it's ([object Text], 3), so insertNode is arguably correct to split the node.
Alexey Proskuryakov
Comment 5 2009-03-19 16:24:39 PDT
I've got a patch that fixes this and bug 24122, which was filed earlier.
Alexey Proskuryakov
Comment 6 2009-03-20 01:18:41 PDT
Oops, I meant to resolve as duplicate.
Alexey Proskuryakov
Comment 7 2009-03-20 01:19:00 PDT
*** This bug has been marked as a duplicate of 24122 ***
Note You need to log in before you can comment on or make changes to this bug.