[whatwg] nextSiblingElement ?
Cameron McCormack
cam at mcc.id.au
Wed Jan 23 22:54:29 PST 2008
Hi Garrett.
Garrett Smith:
> 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;
> };
There is http://www.w3.org/TR/ElementTraversal/, which specifies just
this.
--
Cameron McCormack, http://mcc.id.au/
xmpp:heycam at jabber.org ▪ ICQ 26955922 ▪ MSN cam at mcc.id.au
More information about the whatwg
mailing list