[Webkit-unassigned] [Bug 24896] REGRESSION: Range#collapsed is mis-reported after Range#extractContents is called

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 27 14:35:01 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=24896





------- Comment #3 from eric at webkit.org  2009-03-27 14:35 PDT -------
I think this new behavior is correct.  A better test case would show that.

This test is selecting from [div, 0] to [text, last_offset], and then calling
extract.  The spec says:

http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Extracting
It is important to note that nodes that are partially selected by the Range are
cloned. Since part of such a node's contents must remain in the Range's context
tree and part of the contents must be moved to the new DocumentFragment, a
clone of the partially selected node is included in the new DocumentFragment.
Note that cloning does not take place for selected elements; these nodes are
moved to the new DocumentFragment.

The text node is partially selected in our example.

Moreover the spec says:

Note that if deletion of a Range leaves adjacent Text nodes, they are not
automatically merged, and empty Text nodes are not automatically removed. Two
Text nodes should be joined only if each is the container of one of the
boundary-points of a Range whose contents are deleted. To merge adjacent Text
nodes, or remove empty text nodes, the normalize() method on the Node interface
should be used.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list