Skip to content

Commit

Permalink
Fixed jQuery deprecations (aspnet#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
alowdon authored Jan 23, 2023
1 parent 115bca9 commit bf434b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jquery.validate.unobtrusive.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
function onError(error, inputElement) { // 'this' is the form element
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
replace = replaceAttrValue ? JSON.parse(replaceAttrValue) !== false : null;

container.removeClass("field-validation-valid").addClass("field-validation-error");
error.data("unobtrusiveContainer", container);
Expand Down Expand Up @@ -88,7 +88,7 @@

if (container) {
var replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
replace = replaceAttrValue ? JSON.parse(replaceAttrValue) : null;

container.addClass("field-validation-valid").removeClass("field-validation-error");
error.removeData("unobtrusiveContainer");
Expand Down Expand Up @@ -131,7 +131,7 @@
defaultOptions = $jQval.unobtrusive.options || {},
execInContext = function (name, args) {
var func = defaultOptions[name];
func && $.isFunction(func) && func.apply(form, args);
func && typeof func === "function" && func.apply(form, args);
};

if (!result) {
Expand Down

0 comments on commit bf434b1

Please sign in to comment.