Compare directly with Node.TEXT_NODE for clarity and removed only from test
Updated all if clauses that check TEXT_NODEs to make them more explicit