Fix a second infinite loop in CSSUtils.findSelectorAtDocumentPos()

Fix a second infinite loop in `CSSUtils.findSelectorAtDocumentPos()`, caused by cleanups in the fix for the earlier infinite loop bug (#9002). To keep loop exit condition more precisely in sync with TokenUtils's logic for when to stop advancing, create new TokenUtils methods for checking if at a stopping point.

The existing unit test `"should find the first selector when pos is at beginning of selector name"` already hits the case that was broken here -- basically a curly brace that's _not_ alone on a line, afaict -- so I didn't bother adding any additional unit tests in this PR.

@RaymondLim @MarcelGerber