- From: Cameron McCormack <cam@mcc.id.au>
- Date: Thu, 24 Jan 2008 17:54:29 +1100
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
Received on Wednesday, 23 January 2008 22:54:29 UTC