Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295300

Remove jQuery Form dependency from misc/ajax.js

$
0
0

Problem/Motivation

  • Efforts are underway to remove jQuery from core: #3052002: [meta] Replace JQuery with vanilla Javascript in core. That includes removing the jQuery Form plugin.
  • The jQuery Form plugin is no longer maintained.
  • The only use of the jQuery Form plugin in Drupal core is where misc/ajax.js calls $.ajaxSubmit(). The jQuery Form plugin provided an implementation of that that worked for old browsers. With modern browsers, we can use FormData and fetch() directly without needing to rely on either jQuery Form's $.ajaxSubmit() or even jQuery's $.ajax().

Steps to reproduce

Proposed resolution

  • In misc/ajax.js, replace the call to $.ajaxSubmit() with fetch() if possible, or $.ajax() if that's an easier step and we can then replace $.ajax() with fetch() in a followup.
  • For BC, we should preserve at least some of the existing events, like beforeSerialize(), beforeSubmit(), and beforeSend(). If in addition to those 3 it makes sense to preserve all of the existing $.ajax() events, that might be a point in favor of using $.ajax() over fetch() for now, especially if that can work easily enough with FormData.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 295300

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>