W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Feature suggestion: Hook property on Node

From: Ronald Bourret <rpbourret@rpbourret.com>
Date: Wed, 30 Jan 2002 02:51:40 -0500 (EST)
Message-ID: <3C57A4E7.99535380@rpbourret.com>
To: www-dom@w3.org
It would be nice if the Node interface had a "hook" property -- that is,
a read/write property in which the user could store any value they like.
(I don't know what the IDL type is, but this would be equivalent to
Object in Java or void * in C/C++.)

As an example of why this is useful, consider the problem of
constructing a DOM tree based on external order information. That is,
the DOM construction code receives DOM nodes along with the information,
"This is the third child," "This is the fourteenth child," etc. To
perform this task, the code needs to know the order value associated
with each node in the tree.

With a hook property, the application could store order values with each
node and either build the tree in sorted order or sort after the tree is
complete. Without a hook property, the application must encapsulate each
node and add the order property -- more work than seems necessary.

Another use (inspired by recent discussions on xml-dev) would be storing
the current namespace scoping information. I am certain that many other
uses/abuses could be found as well.

-- Ronald Bourret

P.S. Please cc me on any replies, as I am not a member of this list.
Received on Wednesday, 30 January 2002 10:14:50 GMT

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