2014-05-06 08:19:23 +02:00
|
|
|
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
|
2014-05-06 08:19:23 +02:00
|
|
|
|
2017-09-18 14:13:39 +02:00
|
|
|
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")) {
|
2017-09-18 14:13:39 +02:00
|
|
|
this.attachForm(el)
|
|
|
|
|
}
|
2018-01-09 00:44:20 -05:00
|
|
|
break
|
2014-05-06 08:19:23 +02:00
|
|
|
|
2018-01-09 00:44:20 -05:00
|
|
|
default:
|
|
|
|
|
throw "Pjax can only be applied on <a> or <form> submit"
|
2014-05-06 08:19:23 +02:00
|
|
|
}
|
|
|
|
|
}
|