Hi
I’m writing a javascript code to traverse HTML dom and highlight elements.
My problem is firefox returns whitespaces as text node.
Is there any solution to force it to just return tags? for example I need “firstChild” always return first tag and not any text!
Thanks
You can check if a node is an element with
node.nodeType === 1.You can also implement the new DOM Travelsal API as functions.
usage