Improve HTMLUtils.findBlocks performance

For #9717.
Unfortunately, I couldn't come up with a more general way of doing this in TokenUtils.