W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2002

Re: compareDocumentPosition issues

From: Ray Whitmer <rayw@netscape.com>
Date: Fri, 01 Nov 2002 04:29:15 -0800
Message-ID: <3DC2739B.8020802@netscape.com>
To: www-dom@w3.org

Christopher Aillon wrote:

> If I were using the JavaScript language (as all my examples will use),
> it would then follow that:
>
>   var flags = foo.compareDocumentPosition(foo);
>   flags == 0; // true
>   flags == Node.DOCUMENT_POSITION_DISCONNECTED; // true!?!?
>
> Clearly, this seems to be a problem.  If the SAME_NODE bit has been
> removed, then that is fine, but two identical nodes should not be
> disconnected.

Yes, clearly in this version of the algorithm, disconnected was intended 
to be a non-zero bit.  This was an error in the update to the 
description.  I believe this correctly answers your further questions as 
well.

> In general, I do like the way the WD is going with the updated version of
> compareDocumentPosition.  However, unless I misunderstood the latest WD,
> by removing the SAME_NODE constant and by allowing disconnected nodes to
> have other bits set, it appears there is a need to give disconnected its
> own bit, instead of none.  That would solve both of the issues I raised.
>
> Comments?

Yes.  Equality is the zero case, so disconnected needs a bit assignment.

Thanks,

Ray Whitmer
Received on Friday, 1 November 2002 07:30:08 GMT

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