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
Received on Thursday, 8 January 2004 21:09:18 UTC

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