PDA

View Full Version : Single-level DOM collections


liorean
03-16-2003, 06:30 PM
Hmm, is there any way to get a collection, like that of elm.getElementsByTagName, but that does ONLY include children, not all decendant elements?

Oh, I know how to do one myself, but what I wanted to achieve was the interactivity of the collection - if I add, remove or otherwise change the document structure, the collection is updated with the new structure.

Anyone know if this is possible?
(I know it is in moz, using getters, but I wanted to have a cross-browser version.)

jkd
03-16-2003, 08:33 PM
You could use a TreeWalker or NodeIterator (or even an XPathEvaluator), but only Mozilla supports TreeWalkers and DOM3 XPath...

liorean
03-17-2003, 07:52 AM
Well, DOM3 standard, that moz so far is the only browser to implement, is still better than the moz proprietary getters and setters.

Curious how I know DOM and DOM2 pretty well, but never had a look into DOM3...