I think the name ```hasChildren(elem) { return !elem.childNodes.length; }`` would be better. Also, ```nodeLength()``` is not a good function. It combines the length in characters of text nodes, and the length of elements in number of child nodes. That's overloading the meaning of length to no good purpose.