jquery / sizzle

A sizzlin' hot selector engine.
https://sizzlejs.com
Other
6.29k stars 951 forks source link

Pushstate to a Hash doesn't update :target #466

Closed gone closed 4 years ago

gone commented 4 years ago

If you select $(":target"), and then call pushState with a hash, Although window.location.hash will agree with the url/pushState value, $(":target") will return the initial element. Example failing test here: https://github.com/gone/sizzle/blob/target-pushstate/test/unit/selector.js#L1217

My assumption is that pushState doesn't call onHashChange, while setting window.location.hash does, so an invalidation step is missed.

I'd be happy to submit a pr but I wasn't able to find where that cache is invalidated for the onHashChange event.

dmethvin commented 4 years ago

You have a long read in front of you: https://github.com/jquery/jquery/issues/2679

mgol commented 4 years ago

Closing per Dave's comment above.