[whatwg] nextSiblingElement ?

Garrett Smith dhtmlkitchen at gmail.com
Wed Jan 23 22:50:40 PST 2008


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

Garrett
-- 
boxbe is annoying--> I use Boxbe to protect my email, so please keep
this code in your reply: JPV9KTNZ



More information about the whatwg mailing list