From 6ed297a6b11222f1f1c6d06aa717e6b179f40809 Mon Sep 17 00:00:00 2001 From: Karson Alford Date: Wed, 20 Mar 2019 11:08:41 -0500 Subject: [PATCH 1/2] Prevent evaluation for undefined handlers. --- src/jquery.unobtrusive-ajax.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jquery.unobtrusive-ajax.js b/src/jquery.unobtrusive-ajax.js index 1598cc9..d539679 100644 --- a/src/jquery.unobtrusive-ajax.js +++ b/src/jquery.unobtrusive-ajax.js @@ -23,6 +23,7 @@ data_validation = "unobtrusiveValidation"; function getFunction(code, argNames) { + if (!code) return function() { return null; }; var fn = window, parts = (code || "").split("."); while (fn && parts.length) { fn = fn[parts.shift()]; From 9f9efe52ff93d751fa0f315b5d8d264da51a3a1f Mon Sep 17 00:00:00 2001 From: Karson Alford Date: Wed, 27 Mar 2019 09:24:03 -0500 Subject: [PATCH 2/2] Additional test of undefined/null is no longer necessary. --- src/jquery.unobtrusive-ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jquery.unobtrusive-ajax.js b/src/jquery.unobtrusive-ajax.js index d539679..56ada9c 100644 --- a/src/jquery.unobtrusive-ajax.js +++ b/src/jquery.unobtrusive-ajax.js @@ -24,7 +24,7 @@ function getFunction(code, argNames) { if (!code) return function() { return null; }; - var fn = window, parts = (code || "").split("."); + var fn = window, parts = code.split("."); while (fn && parts.length) { fn = fn[parts.shift()]; }