W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2011

[whatwg] Node inDocument

From: Robin Berjon <robin@berjon.com>
Date: Tue, 30 Aug 2011 11:58:21 +0200
Message-ID: <38F75338-92DC-48A7-A32F-5CE55169B94B@berjon.com>
On Aug 30, 2011, at 11:40 , James Graham wrote:
> On 08/30/2011 10:44 AM, Anne van Kesteren wrote:
>> On Tue, 30 Aug 2011 10:38:19 +0200, Jonas Sicking <jonas at sicking.cc> wrote:
>>> In general I think it's better to have functions that deal with child
>>> lists on Node rather than on Element/Document/DocumentFragment.
>>> 
>>> I think it might still make sense to have inDocument though. That'll
>>> allow people to more clearly express what they are actually trying to
>>> do, while allowing implementations to write faster code.
>> 
>> If we are going to have Node.contains implementations surely could
>> optimize document.contains(node) which seems as clear as node.inDocument
>> to me.
> 
> They are different in the case of multiple documents though.

But node.ownerDocument.contains(node) isn't. There's no doubt that node.inDocument is less error-prone though.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon
Received on Tuesday, 30 August 2011 02:58:21 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:35 UTC