Check for nodeType to avoid dom nodes