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

[whatwg] Node inDocument

From: Erik Arvidsson <arv@chromium.org>
Date: Wed, 31 Aug 2011 15:18:26 -0700
Message-ID: <CAJ8+GogAmYuSa51Dh7e72+13ZJJZRFiTBXC8vm8Fy3y-8gemrA@mail.gmail.com>
After thinking more about this we believe that moving contains to Node
is a better alternative. The problem with Node inDocument is that it
does not say which document it is in so code would need to also check
ownerDocument to be robust in the presence of frames and multiple
windows.

erik

On Tue, Aug 30, 2011 at 03:02, Anne van Kesteren <annevk at opera.com> wrote:
> On Tue, 30 Aug 2011 11:58:21 +0200, Robin Berjon <robin at berjon.com> wrote:
>>
>> But node.ownerDocument.contains(node) isn't. There's no doubt that
>> node.inDocument is less error-prone though.
>
> Depends on the use case. The thread started with "the document" in which
> case you want document.contains().
>
>
> --
> Anne van Kesteren
> http://annevankesteren.nl/
>
Received on Wednesday, 31 August 2011 15:18:26 UTC

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