Correct IE detection code for containsNode workaround

Though a tiny code change, this appears to grant a further 20% speed
improvement for position iteration.
Migrate per-node checks out of TextPositionFilter

Moving these checks into a node filter ensures it is only required
once per node, rather than once per node-position.

This results in a 60% improvement in position iteration speed.
Cache commonly used global object variables