Re: NodeList interface

The standard kluge-around for almost tolerable efficiency seems to be to
have NodeList cache everything it finds, refresh that cache if the tree
structure has changed below the point getElementsByTagName was started
from, and have the length() operation immediately fill the whole cache
(since it has to walk the subtree anyway to answer this question). Then it
becomes a question of how much work you're willing to do in the cache --
whether you throw it all away and start over, or try to refresh only the
changed subtrees.

Very to extremely ugly internally, in exchange for a simplified API. Some
would say excessively simplified. Definitely a religious issue.

I know how you feel; I too learned about the DOM only after this war had
ended and I don't like the outcome... but we're stuck with it in Level 1.
Level 2, hopefully, will have better-architected alternatives and we can
try to discourage people from using getElementsByTagName at that time.

______________________________________
Joe Kesselman  / IBM Research
Unless stated otherwise, all opinions are solely those of the author.

Received on Friday, 25 September 1998 14:35:50 UTC