Clone options in attach-link to prevent requestOptions changes from persisting

This commit is contained in:
Tim Trinidad
2018-01-23 13:22:31 -05:00
parent e4b3952589
commit 526a0883a2
2 changed files with 11 additions and 4 deletions

View File

@@ -6,10 +6,11 @@ var clone = require("../clone")
var attrClick = "data-pjax-click-state"
var formAction = function(el, event) {
// Since we'll be modifying request options, clone the existing options
// so these changes don't persist
// Since loadUrl modifies options and we may add our own modifications below,
// clone it so the changes don't persist
var options = clone(this.options);
// Initialize requestOptions
options.requestOptions = {
requestUrl: el.getAttribute("action") || window.location.href,
requestMethod: el.getAttribute("method") || "GET",