Add TEXT_NODE constant to text check

This commit replaces an occurrence of the integer 3 with the
Node.TEXT_NODE constant. That returns 3 in both Chrome and Firefox,
and makes the code a bit more intention-revealing. I actually had
to look up what node type 3 was. I suppose, in hindsight, that it
should've been obvious, but it wasn't right away, which was the
reason for this PR!