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

range.surroundContents

From: Jonas Sicking <sicking@bigfoot.com>
Date: Thu, 1 Jun 2000 04:27:21 +0200
Message-ID: <028801bfcb70$eaf71420$3110f7d4@Milwork08>
To: <www-dom@w3.org>
Hi!

DOM2 CR section 8.10 [1] says that if you apply the surroundContents method
to the following range (stars marking range start and end):

<FOO>A*B<BAR>C*D</BAR>E</FOO>

An exception should be thrown.
However, if you follow the steps described a bit further up in the same
section you would get the following DOM tree:

<FOO>A*<NEW>B<BAR>C</BAR></NEW>*<BAR>D</BAR>E</FOO>

Which I think is the most useful result. Is there a reason that an exception
should be thrown?

Also, the CR says that all children of the new node should be deleted before
the node is inserted. Couldn't it be useful to allow attribute nodes to
remain.  In other words allowing operations like:

Before:
<FOO>*ABC*</FOO>
After:
<FOO>*<BAR a="b">ABC</BAR>*</FOO>

[1] http://www.w3.org/TR/DOM-Level-2/range.html#Level-2-Range-Surrounding

/ Jonas Sicking
Received on Wednesday, 31 May 2000 22:26:43 GMT

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