Bug 47916 - selectAllChildren & extractContents do not extract all contents
Summary: selectAllChildren & extractContents do not extract all contents
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 11:36 PDT by Ryosuke Niwa
Modified: 2017-07-18 08:30 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2010-10-19 11:36:36 PDT
window.getSelection().selectAllChildren(test);
window.getSelection().getRangeAt(0).extractContents();

does not extract all the contents in test because we canonicalize the selection.

For example, if div was:
<div id="test"><a href="http://webkit.org/">hello</a></div>

The above script results in
<div id="test"><a href="http://webkit.org/"></a></div>

because the endContainer of getRangeAt(0) is "hello" (TextNode).