Add simple refresh method and protect against links being bound more than once. #36
Reference in New Issue
Block a user
Delete Branch "refresh"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This will add a basic
.refreshmethod which can be called by the user to refresh links on their page to be pjaxified.It also adds a data attr to links when they are pjaxified so that they can't be double-bound.
@MoOx thanks for checking this out. I made some updates based on your comments. I actually do think it makes more sense for this to be called refresh, and the existing method to be called reload (as it does reload the page). Let me know what you think.
It's better than nothing.
Good work. Thanks !
Tests are broken but it seems related to a tiny thing, so I'm merging.
I'll update some tiny stuff and prepare CHANGELOG for a future release.
Thanks!
@MoOx @pklada I'm currently building something using PJAX that requires me to use the helpful new
refreshmethod. However, the existing implementation doesn't currently work, asrefreshusesparseDomwhich in turn callsthis.getElements... which is undefined asthisis assigned to the global scope.A simple fix I have tested is to reference the current PJAX instance's
parseDOMmethod instead:If you like, I can submit a new PR with this change.