W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2004

Re: L3 Core: adopting into their existing document

From: Andrew Clover <and-w3@doxdesk.com>
Date: Fri, 9 Jan 2004 01:48:33 +0000
To: www-dom@w3.org
Message-ID: <20040109014833.GA9186@doxdesk.com>

Curt Arnold <carnold@houston.rr.com> wrote:

> Test documentadoptnode28 (unintentionally?) adopts a node into its 
> current document.  Allowing this case seems undesirable

I'm not entirely convinced. I think allowing it could be useful for writing
simpler code in situations where you want an orphan node and you don't care
where it's coming from.

Experience shows destination.importNode(source) where source.ownerDocument
can be destination to be useful even though the spec is (it seems to me)
equally as unclear on the question of whether "another document" is allowed
to be "this document". If the user expectation for adoptNode is "like
importNode but the source disappears" I think it's reasonable to allow it.

Certainly it should either be allowed or throw WRONG_DOCUMENT; a no-op or a
clone are both undesirable as they leave the source document in an
unexpected state. One shouldn't have the same parentNode after being adopted!

-- 
Andrew Clover
mailto:and@doxdesk.com
http://www.doxdesk.com/
Received on Thursday, 8 January 2004 21:09:18 GMT

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