W3C home > Mailing lists > Public > www-dom@w3.org > April to June 1998

Re: critique of WD-DOM-19980416

From: Justin Wells <reader@semiotek.com>
Date: Sat, 27 Jun 1998 21:12:02 -0400
Message-ID: <19980627211202.55931@fever.semiotek.com>
To: Justin Wells <reader@semiotek.com>
Cc: www-dom@w3.org

Comment on knowledge of Document:

As written now, the DOM implies that all new objects are created using the 
Document interface. 

I agree with this, as it allows the mixing of different DOM implementations
in one program, the mixing of objects from different servers in a 
distributed environment, a convenient place to take care of persistence 
issues, and so forth. 

However this has another implication which has not been explicitly dealt 
with in the current API:

Many objects in the system are going to have to know what document they 
belong to. 

For example, it is possible to create new attributes without using 
the Document directly:

   Element elem = Document.createElement(...);
   elem.setAttribute(name, value);  
   Attribute attr = elem.getAttributeNode(name);

So somehow Element had to know how to create a new Attribute, presumably 
by calling Document.createAttribute(..) -- which means that Element has 
a way of finding out what Document it belongs to. 

Note that it would be unwise for Element to try and bypass its containing
Document when creating new Attributes, since the Document might have some 
specific values that need to be set in the Attribute for persistence 
reasons, etc., that may be different from one document to the next.

The consequence of all this is that I think there should be a 


method present on some of the objects. All Node objects could have this 
method, though many of them might find their containing document by 
asking their parent (to save wasting memory on many references).

Received on Saturday, 27 June 1998 21:11:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:04 UTC