Olli Pettay wrote:
Ian Hickson wrote:
The test verifies that when you call insertNode() on a range, the node
that is passed is inserted into the range, as is required by DOM2 range
section 2.9. Inserting Content, sentences 1 and 2 (before and after the
code snippet).
The 2nd sentence doesn't require adding node to range. It talks about
context tree which isn't the same thing as range.
-Olli
"A node may be inserted into a Range using the following method:"
- 'may' is pretty vague.
"The insertNode() method inserts the specified node into the Range's
context tree. "
- In 2.2.1 "... the content of a Range must be entirely within the
subtree rooted by a single Document, DocumentFragment or Attr Node.
This common ancestor container is known as the root container of the
Range. The tree rooted by the root container is known as the Range's
context tree."
So that doesn't say that the node is inserted to Range, but to
context tree.
"The node is inserted at the start boundary-point of the Range, without
modifying it."
What does the 'it' actually refer to? Boundary-point or Range or node?
And since end boundary-point isn't mentioned, one could argue that the
behavior defined in 2.12.1 should be used. When the range is collapsed,
the following:
"Note that when content is inserted at a boundary-point, it is
ambiguous as to where the boundary-point should be repositioned if
its relative position is to be maintained. There are two
possibilities: at the start or at the end of the newly inserted
content. We have chosen that in this case neither the container nor
offset of the boundary-point is changed. As a result, the
boundary-point will be positioned at the start of the newly inserted
content."
-Olli