[whatwg] nextSiblingElement ?
Garrett Smith
dhtmlkitchen at gmail.com
Wed Jan 30 23:02:57 PST 2008
On Jan 24, 2008 5:40 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Wed, 23 Jan 2008, 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.
>
> One of the following drafts probably already handles your needs:
>
> http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html#TreeWalker
> http://www.w3.org/TR/ElementTraversal/
>
To create a tree walker, define an accept() and then iterate through
nodes, would be more effort than rewriting the hand-rolled
Dom.getNextSibling function I posted every time. I guess I could
replace the source code of my dom.getNextSiblingElement, but a for()
loop is probably simpler.
REally, all I want is
nextSiblingElement/previousSiblingElement/childElements properties so
I don't have to have library code or write a for() loop every time i
want to just find the next sibling element.
Garrett
> HTH,
> --
> Ian Hickson U+1047E )\._.,--....,'``. fL
> http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
> Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list