W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1998


From: Stephen R. Savitzky <steve@crc.ricoh.com>
Date: 27 Jul 1998 16:45:09 -0700
To: www-dom@w3.org
Message-ID: <qcpveqamey.fsf_-_@gelion.crc.ricoh.com>
The DOM specification states:
           The parent of the given Node instance. All nodes, except
           Documents and DocumentFragments, have a parent. If a node has
           just been created and not yet added to the tree, it has an
           implicit parent which is a DocumentFragment.

This strikes me as misguided.  Surely it's better for a newly-created Node
to have a null parent.  Otherwise, the process of creating a Node and adding
it to a tree consists of:

  creating a new DocumentFragment
  creating the Node.
  adding the new Node to the DocumentFragment's children

  removing the new Node from the DocumentFragment's children
  adding the new Node to the tree in the correct place

  ... at which point we probably have no references remaining to the
  DocumentFragment, so it hangs around taking up space until the garbage
  collector scavenges it.

Of course, the DocumentFragment in question could be effectively a freelist,
but why constrain the implementation, and wouldn't a NodeList be more
appropriate for the purpose?

It looks as if there was a point in the spec's evolution where somebody
attempted to replace NodeList with DocumentFragment.

 Stephen R. Savitzky   Chief Software Scientist, Ricoh Silicon Valley, Inc., 
<steve@rsv.ricoh.com>                            California Research Center
 voice: 650.496.5710   fax: 650.854.8740    URL: http://rsv.ricoh.com/~steve/
  home: <steve@starport.com> URL: http://www.starport.com/people/steve/
Received on Monday, 27 July 1998 20:59:24 UTC

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