DOM2 - Range- ambiguity in surroundContents exceptions

Hi,

I believe there is an ambiguity in the way the HIERARCHY_REQUEST_ERR exception 
is defined for the DOM Level2 Range's surroundContents method:

"HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range is 
of a type that does not allow children of the type of newParent "

2.2.1: "If the container is a CharacterData, Comment or ProcessingInstruction 
node, the offset is between the 16-bit units of the UTF-16 encoded string 
contained by it."

It is therefore implied that the 'container' of a textual boundary point is 
the text node itself.

In those conditions, according to the exception definition, surrounding a 
textual range X with an element node Y should raise, as Y (newParent) is of a 
type that is not allowed in the container of the start of the Range X.

at the same time, the examples of 2.10 make clear that such a surrounding is 
possible:

"     Before:
       <BAR>A[B<MOO>C</MOO>D]E</BAR>

     After surroundContents(FOO):

<BAR>A[<FOO>B<MOO>C</MOO>D</FOO>]E</BAR>
"
(emphasis of Range with [] characters)

Greetings,
Germain

Received on Thursday, 3 April 2008 12:06:49 UTC