This will add a basic .refresh method 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.
This will add a basic `.refresh` method 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.
@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.
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.
@MoOx @pklada I'm currently building something using PJAX that requires me to use the helpful new refresh method. However, the existing implementation doesn't currently work, as refresh uses parseDom which in turn calls this.getElements... which is undefined as this is assigned to the global scope.
A simple fix I have tested is to reference the current PJAX instance's parseDOM method instead:
If you like, I can submit a new PR with this change.
@MoOx @pklada I'm currently building something using PJAX that requires me to use the helpful new `refresh` method. However, the existing implementation doesn't currently work, as `refresh` uses `parseDom` which in turn calls `this.getElements`... which is undefined as `this` is assigned to the global scope.
A simple fix I have tested is to reference the current PJAX instance's `parseDOM` method instead:
``` js
module.exports = function(el) {
this.parseDOM(el || document)
}
```
If you like, I can submit a new PR with this change.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.