Update `onclick` to better support hashbang paths

I had some trouble linking to other pages after enabling the `hashbang` option. Even though a URL like `/demo.html#!/events` would work fine when manually entered, the same URL used in a link just updated the URL but didn't load any route (even if a catchall were specified).

I dug into the code a bit and found that the `onclick` function was stripping everything after `#` and treating it as a hash parameter. That makes sense if `hashbang` is set to false, but otherwise the hashbang should be considered part of the pathname.

I did my best to fix up the behavior without affecting how things work with `hashbang` disabled. Tests are passing with a few tweaks. Feedback is welcome, and I'm happy to discuss alternative approaches. Thanks!