Use `indexOf` on textContent instead of `contains`

This fixed the problem with Chrome incompatibility.