From a605d772b684593cfb8f850f4849f441fb176ede Mon Sep 17 00:00:00 2001 From: nod_ Date: Wed, 20 Mar 2024 21:37:06 +0100 Subject: [PATCH] Issue #3432151 by Tom Konda, longwave: [jQuery 4] ajax.js and jquery.form.js use deprecated function $.parseJSON() --- core/misc/ajax.js | 2 +- core/misc/jquery.form.js | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/misc/ajax.js b/core/misc/ajax.js index ad1a3c999ff..7483108f6b3 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -554,7 +554,7 @@ // Sanity check for browser support (object expected). // When using iFrame uploads, responses must be returned as a string. if (typeof response === 'string') { - response = $.parseJSON(response); + response = JSON.parse(response); } // Prior to invoking the response's commands, verify that they can be diff --git a/core/misc/jquery.form.js b/core/misc/jquery.form.js index d78ca6197d8..335123caf8e 100644 --- a/core/misc/jquery.form.js +++ b/core/misc/jquery.form.js @@ -922,10 +922,6 @@ return (doc && doc.documentElement && doc.documentElement.nodeName !== 'parsererror') ? doc : null; }; - var parseJSON = $.parseJSON || function(s) { - /* jslint evil:true */ - return window['eval']('(' + s + ')'); // eslint-disable-line dot-notation - }; var httpData = function(xhr, type, s) { // mostly lifted from jq1.4.4 @@ -943,7 +939,7 @@ } if (typeof data === 'string') { if ((type === 'json' || !type) && ct.indexOf('json') >= 0) { - data = parseJSON(data); + data = JSON.parse(data); } else if ((type === 'script' || !type) && ct.indexOf('javascript') >= 0) { $.globalEval(data); }