function next(element) { while (element = element.nextSibling) if (element.nodeType === 1) return element; return null; }