Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
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:
- 3432151-jquery-4-ajax.js changes, plain diff MR !7093
Comments
Comment #3
Tom KondaComment #4
Tart0I think, a lot of "old" jQuery code could / should be moved to vanilla to prevent most of those deprecations.
Comment #5
longwave@Tart0 see #3238306: [META] Where possible, refactor existing jQuery uses to vanillaJS to reduce jQuery footprint, we need help in many child issues to make that switch.
Comment #6
longwaveThe only other place
$.parseJSON
appears is in core/misc/jquery.form.js, I think we should fix it there too while we are here?Comment #7
longwaveComment #8
Tart0@longwave wasn't aware of that meta issue, i'll give a look and provide as much as I can, thanks !
Comment #9
smustgrave CreditAttribution: smustgrave at Mobomo commentedConfirmed all instances of $.parseJSON have been replaced.
Comment #10
nod_Committed a605d77 and pushed to 11.x. Thanks!
There is no rule for that in
eslint-plugin-jquery
so leaving as-isComment #13
nod_