github jquery-form/form v5.0.0-beta.1
5.0.0-beta.1

pre-release4 hours ago

5.0 is a major release with breaking changes. Read the migration guide before upgrading: each change below links to its entry, with who is affected and before and after code. With $.fn.ajaxSubmit.debug = true, the latest 4.x logs a warning for most of the features 5.0 removes. 4.x stays available (npm install jquery-form@4) and gets security fixes on a best-effort basis, with no set end date; see the security policy.

Install the beta

npm i jquery-form@next

jquery is now a peer dependency, so install it too if your project does not list it: npm i jquery@^3.7.1 jquery-form@next. The beta is on the next dist-tag; npm i jquery-form still installs 4.x. Please report problems on #629 or in a new issue. The pull request is #646.

Highlights

  • Sends what a native submission sends. Fields follow tree order, only buttons, inputs, selects and textareas are sent, and image buttons, dirname, _charset_ and empty file inputs follow the HTML spec. The guide's "What your server receives" table shows each request body before and after.
  • A smaller, modern plugin. jQuery 3.5+ only, current browsers only, ES2020 syntax with no transpile; the jQuery < 3, Internet Explorer, Opera Presto and EdgeHTML code is gone. The minified build is 23.8 kB (9.1 kB gzip), down from 26.5 kB (10.1 kB gzip) in 4.6.0.
  • An exports map. Node import gets the module build, bundlers get it for import and require, and require in Node keeps the CommonJS factory.
  • Selector options are only selectors. A string in target, iframeTarget or includeHidden is never parsed as HTML, so it can't create elements.

Breaking changes

Platform

Packaging

Removals

Behavior and serialization

Kept on purpose (see Differences from a native submission): a selected file makes the request multipart without enctype, a GET request keeps the action's query, and a clicked submit input without a value sends an empty value.

The iframe transport: tell us if you use it

5.0 keeps the hidden-iframe upload transport, but only when you pass iframe: true; every other upload uses FormData. It may be removed in 6.0. If you use iframe: true, comment on #629 with your use case.

Docs

  • A new migration guide, in the docs site menu as "Upgrading to 5.0" and linked from the README, with a "New in 5.0" section.
  • The API page documents every method, including formToArray, enable, selected and $.fieldValue, and lists what 5.0 removes.
  • The options page documents includeHidden, the iframe rejection arguments that differ from $.ajax, and the deliberate differences from a native submission.
  • The examples are rewritten for 5.0, with no demo server and with server snippets that escape their output. The Form Fields page shows what fieldValue and fieldSerialize return, and the FAQ is rewritten.
  • SECURITY.md supports 5.x, with 4.x fixes on a best-effort basis.

Testing (no effect on the published files)

  • The suite runs on Chromium, WebKit and Firefox with jQuery 3.5.0, 3.7.1 and 4.0.0 (1112 tests per jQuery version), at 100% coverage.
  • The serialization oracle and the end-to-end tests compare with a native submission; the differences from a native submission that 5.0 removes are no longer allowed in them.
  • Published-file tests check each exports key, Node import resolving to the module build, the module condition, and that a deep src import fails.
  • Every breaking change has a test that fails on 4.6.0 and an entry in the migration guide.
  • The package is published from CI with npm provenance; pre-releases go to the next dist-tag.

Don't miss a new form release

NewReleases is sending notifications on new releases.