Problem/Motivation

There is jQuery.parseJSON() in /core/misc/ajax.js at line 557. But this function is removed from jQuery 4, need to be replaced the other equivalent function.

Proposed resolution

Use JavaScript native JSON.parse().

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3432151

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Tom Konda created an issue. See original summary.

Tom Konda’s picture

Status: Active » Needs review
Tart0’s picture

I think, a lot of "old" jQuery code could / should be moved to vanilla to prevent most of those deprecations.

longwave’s picture

longwave’s picture

Title: [jQuery 4] ajax.js uses deprecated function $.parseJSON() » [jQuery 4] ajax.js and jquery.form.js use deprecated function $.parseJSON()
Status: Needs review » Needs work

The only other place $.parseJSON appears is in core/misc/jquery.form.js, I think we should fix it there too while we are here?

longwave’s picture

Status: Needs work » Needs review
Tart0’s picture

@longwave wasn't aware of that meta issue, i'll give a look and provide as much as I can, thanks !

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed all instances of $.parseJSON have been replaced.

nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed a605d77 and pushed to 11.x. Thanks!

There is no rule for that in eslint-plugin-jquery so leaving as-is

  • nod_ committed a605d772 on 11.x
    Issue #3432151 by Tom Konda, longwave: [jQuery 4] ajax.js and jquery....
nod_’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.