Update the CSS optimizer to end a URL path at a hash as well as a question mark

Fixes #17243