W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2008

DOM2 - Range- ambiguity in surroundContents exceptions

From: Germain Garand <germain@ebooksfrance.org>
Date: Thu, 3 Apr 2008 14:04:30 +0200
To: www-dom@w3.org
Message-Id: <200804031404.31009.germain@ebooksfrance.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:59 GMT