changed existing refresh method to reload. changed the data check to trigger a refresh on the element based on the already bound data attr
This commit is contained in:
@@ -44,8 +44,8 @@ var linkAction = function(el, event) {
|
||||
|
||||
// don’t do "nothing" if user try to reload the page by clicking the same link twice
|
||||
if (el.href === window.location.href.split("#")[0]) {
|
||||
el.setAttribute(attrClick, "refresh")
|
||||
this.refresh()
|
||||
el.setAttribute(attrClick, "reload")
|
||||
this.reload()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -56,8 +56,6 @@ var linkAction = function(el, event) {
|
||||
module.exports = function(el) {
|
||||
var that = this
|
||||
|
||||
el.setAttribute("data-pjax-enabled", "true");
|
||||
|
||||
on(el, "click", function(event) {
|
||||
linkAction.call(that, el, event)
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ module.exports = function(el) {
|
||||
switch (el.tagName.toLowerCase()) {
|
||||
case "a":
|
||||
// only attach link if el does not already have link attached
|
||||
if (!el.getAttribute("data-pjax-enabled")) {
|
||||
if (!el.hasAttribute('data-pjax-click-state')) {
|
||||
this.attachLink(el)
|
||||
}
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user