- From: Maciej Stachowiak <mjs@apple.com>
- Date: Wed, 23 Jan 2008 23:30:32 -0800
On Jan 23, 2008, at 10:50 PM, Garrett Smith wrote: > nextSibling and previousSibling are useful, but not always what I > want. > > I usually want to get a siblingElement than a sibling, which might be > a text node. > > Dom.findNextSiblingElement = function(el) { > for(var ns = el.nextSibling; ns != null; ns = ns.nextSibling) > if(ns.nodeType == 1) > return ns; > return null; > }; > > The same is true for childNodes. > > It would be useful to have: > > nextSiblingElement, > previousSiblingElement, > childElements The W3C's Web API Working Group is working on an "Element Traversal" spec that provides functionality like this. Cheers, Maciej
Received on Wednesday, 23 January 2008 23:30:32 UTC