Files
pjax/lib/proto/parse-element.js

21 lines
527 B
JavaScript
Raw Normal View History

module.exports = function(el) {
switch (el.tagName.toLowerCase()) {
2018-01-09 00:44:20 -05:00
case "a":
// only attach link if el does not already have link attached
if (!el.hasAttribute("data-pjax-click-state")) {
this.attachLink(el)
}
break
case "form":
// only attach link if el does not already have link attached
2018-01-09 00:44:20 -05:00
if (!el.hasAttribute("data-pjax-click-state")) {
this.attachForm(el)
}
2018-01-09 00:44:20 -05:00
break
2018-01-09 00:44:20 -05:00
default:
throw "Pjax can only be applied on <a> or <form> submit"
}
}