Re: compareDocumentPosition issues

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 UTC