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

Re: range.surroundContents

From: Lauren Wood <lauren@sqwest.bc.ca>
Date: Tue, 27 Jun 2000 11:37:11 -0700
To: <www-dom@w3.org>
Message-ID: <395891E7.311.8E2D4B@localhost>
On 1 Jun 2000, at 4:27, Jonas Sicking wrote:

> 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):
> 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:
> Which I think is the most useful result. Is there a reason that an exception
> should be thrown?

surroundContents is a convenience function designed for use with 
well-formed subtrees. Given that, the fix-ups that occur when you 
go through the steps seem to not be intuitive. If you really want to 
be able to, in effect, surround a non-well-formed subtree, you can 
go through the steps and let the automatic fix-ups happen. 
Hopefully the results won't then seem as non-intuitive.

> 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.  

Attributes aren't children of an element. They are assoicated with 
an element.

Received on Tuesday, 27 June 2000 14:37:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC