A bug-fix release. No breaking changes are intended. Behavior changes only where the old behavior was a bug or differed from a native form submission, so read the list below if your code relied on any of them. jQuery 1.7.2 or later is still supported. Every change is tested on jQuery 1.7.2, 3.7.1 and 4.0.0, and the test suite now runs on Chromium, Firefox and WebKit.
Fixes
targetandiframeTargetstrings are looked up only as selectors. Both were passed to$(), which builds elements from a string that looks like HTML and runs any inline handlers in it. A string is now looked up with$(document).find(). A selector finds the same elements as before. A string that starts with<matches nothing (and logs a message when$.fn.ajaxSubmit.debugis on). On jQuery 1.7.2, a selector with a tag in an attribute value, such asdiv[title="<b>"], now works. Elements and jQuery objects are used as given.- A lone surrogate is sent as U+FFFD.
formSerialize,fieldSerialize,ajaxSubmitand iframe uploads threwURIErrorwhen a field name or value, or a key or string value indataorextraData, held an unpaired UTF-16 surrogate. Each one is now replaced with U+FFFD, as a native form submission andFormDatado. A stringdataoption is passed through unchanged. - Spaces encode as
+on every jQuery version. On jQuery 3 and later,formSerialize,fieldSerialize, GET query strings and urlencoded bodies wrote a space as%20, while jQuery 1 and 2 and a native form submission write+. They now write+everywhere. Servers decode both the same way; only code that compares the strings sees a difference. - An iframe response that cannot be parsed rejects with
parsererror, aserrorandcompletealready reported. When the response also carries an error status (astatusattribute outside 2xx),error,ajaxErrorand the rejection receive itsstatusText, as$.ajaxreports a server error. - An iframe upload no longer sends a clicked button that a disabled
<fieldset>disables, as the other transports and a native submission already did.
Packaging
- Bundlers get the module build. The
browserfield pointed at the minified classic build, so webpack, Vite and Browserify bundled it. It is removed: webpack and Vite usemodule(dist/jquery.form.mjs) and Browserify usesmain(dist/jquery.form.js). Newjsdelivrandunpkgfields keep a bare CDN URL servingdist/jquery.form.min.js. - The CommonJS factory uses the window it is given.
require("jquery-form")(root, $)read the globalwindowanddocument, so it threw in Node without a global DOM. It now takes them fromroot. LICENSE-MITis in the package, next toLICENSE. The license field is now the SPDX expression(LGPL-2.1-or-later OR MIT): the same terms, written the current way.- The package
homepageis the docs site, https://jquery-form.github.io/form/.
Deprecations
- Replacing
$.fieldValueto change what is serialized logs a deprecation warning once per page when$.fn.ajaxSubmit.debugis on. It still works in 4.x; 5.0 drops it, so use jQueryvalHooksinstead. - The API docs now have a Deprecations section listing every warning and its replacement.
Docs
- The README is now a short landing page: installation, usage (module import, CommonJS, script tag), file uploads, compatibility and security. The full reference is on the docs site.
- The docs site's links to old malsup.com pages point at its own pages, and its demos load over https.
- Bug reports use an issue form that asks for the plugin, jQuery and browser versions. Security reports go through
SECURITY.md.
Full changelog: v4.5.0...v4.6.0