Check for selector validity more thoroughly.