W3C home > Mailing lists > Public > www-dom-ts@w3.org > April 2001

Node identity comparisons

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Fri, 20 Apr 2001 10:40:00 -0600
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08ABDE@THOR>
To: "'www-dom-ts@w3.org'" <www-dom-ts@w3.org>
Those of you who are steeped in the arcania of the DOM spec may be able to answer this for me.  It seems that a developer would expect (but that expectation may not be justified by the DOM spec), that
accessing the same underlying node would result in objects that would pass an identity comparison.

For example, you would expect that these expressions would be true:

boolean test1 = (docElem == docElem.getFirstChild().getParentNode());
boolean test2 = (docElem.getChildren.item(0) == docElem.getFirstChild());
boolean test3 = (docElem.getFirstChild() == docElem.getFirstChild());

They probably are for most processors, however I'm pretty sure that they would fail for Xerces-COM since it allocates a new COM wrapper for the underlying node on each request, so that multiple
independent objects access the same underlying node.

So, are there any statements in the DOM specs about object identity comparisons?  If object identity comparisons are covered by the spec, then there need to be tests added to check to see if they work
as expected.
	
Received on Friday, 20 April 2001 12:42:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 6 April 2009 12:58:42 GMT