[selectors] Ignore empty trailing path segments. More clean-up.