Skip to content

feat!: jquery-form 5.0 - #646

Open
kevindb wants to merge 77 commits into
mainfrom
phase-14
Open

kevindb wants to merge 77 commits into
mainfrom
phase-14

Conversation

@kevindb

@kevindb kevindb commented Nov 27, 2026

Copy link
Copy Markdown
Member

Summary

jquery-form 5.0, the breaking release. Every change has an entry in docs/migrating-to-5.md, with who is affected and before and after code. It ships first as 5.0.0-beta.1 on the npm next dist-tag; latest stays on 4.6.0 until 5.0.0.

 package
-  dependencies: jquery >=1.7.2
+  peerDependencies: jquery >=3.5.0          # tested on 3.5.0, 3.7.1, 4.0.0
+  exports: { ".": module | import (.mjs) | require (UMD) }
-  files: dist, src
+  files: dist                               # src is no longer published
   builds: ES2020 as written, no transpile   # current Chrome, Edge, Firefox, Safari

 sending a form
-  iframe transport chosen when FormData is missing
+  iframe transport only with iframe: true
-  image buttons and controls outside the form (form="id") sent out of tree order
+  every field in tree order, as a native submission sends them
+  image buttons, dirname, _charset_ and empty file inputs as the browser sends them
-  selector options (target, iframeTarget, includeHidden) parsed as HTML when they look like markup
+  selector options only ever matched as selectors

 API
-  clearInputs, attr2, closeKeepAlive, semantic, delegation: true, the pre-3.0 DOM-ready queue
+  delegation: "<selector>"
+  jQuery valHooks, not a replaced $.fieldValue, changes what is sent
src/
├── jquery.form.js          # entry: registers $.fn methods and $.fieldValue
├── ajax-form.js            # ajaxForm, ajaxFormUnbind, delegation
├── submission.js           # one ajaxSubmit call: options, callbacks, target
├── successful-controls.js  # which controls are sent, and their fields
├── xhr-transport.js        # $.ajax with urlencoded, FormData or JSON bodies
├── iframe-*.js             # the iframe: true transport
├── field-helpers.js        # fieldValue, fieldSerialize, clear/reset, enable, selected
└── …                       # options, submitter, form members and attributes, diagnostics

Also in this PR:

  • Docs: the site gets an "Upgrading to 5.0" menu entry, a complete API page and rewritten examples with no demo server. SECURITY.md supports 5.x, with 4.x fixes on a best-effort basis.
  • Release workflow: release.yml picks the dist-tag: next for a pre-release, v<major> for an older major, and otherwise latest, never moving latest back.

The iframe transport is kept in 5.0 and may be removed in 6.0. If you use iframe: true, comment on #629 with your use case.

Evidence

  • Before (4.6.0): the 5.0 suite fails 123 tests against the 4.6.0 build. Every failure maps to a migration guide entry. The other 986 tests pass on both builds and pin the contracts 5.0 keeps.
    After (5.0.0-beta.1):
    • On the tip, npm test: Chromium 1,098 passed, WebKit 1,077 passed, 100% coverage.
    • On the tip, npm run test:e2e: 474 passed (the native-submission comparison, through a real server), and 23 of 23 published-package tests against the packed tarball.
    • Since the last source change: the suite in Chromium on jQuery 3.5.0 and 4.0.0, and in Firefox. The full browser and jQuery matrix ran before the final review changes; CI runs it again on this PR.
    • Mutation testing over src: 95.51%.
    • CodeQL with security-extended and the repo's query pack: no results. Each fixed XSS sink, reopened on purpose, is flagged.

Merge Danger

Door: two-way for the merge, one-way for publishing

Merging changes main only. Pushing a v5.0.0-beta.N tag publishes to npm on next, which can't be unpublished after 72 hours. release/4.x is cut from v4.6.0 just before this merges, and it needs the release.yml dist-tag commit cherry-picked first, or a 4.x patch would take latest.

Blast Radius: consumers

Anyone who installs jquery-form@latest after 5.0.0 gets the breaking changes: pages on jQuery before 3.5 or old browsers, deep src imports, and servers that depend on 4.x's field order or image-button fields. The beta reaches only people who ask for @next. The docs site builds from main, so it switches to 5.0 docs on merge.

🤖 Generated with Claude Code

bower.json and composer.json ask for the same range. Renames the manifest test "should agree on the version with the registry manifest and every dist banner" to "... with every dist banner".
3.5.0 comes from the jquery35 npm alias, so scripts/fetch-jquery.sh goes; the packed-package fixtures add 3.5.0.
X2: replaces the 4.x deprecateOldJQuery warning and its seven tests with requireJQuery35 and its throw tests; nothing throws at load.
The check named 3.7.1 only, so the new 3.5.0 fixture took the jQuery 4 branch.
… before 3 paths

Removes 30 tests (16 attr2, 11 ready queue, 3 no prop/on/offset) and renames or edits the tests that branched on jQuery before 3.
Also drops the $.error guard and the "+" undo in deepSerialize, which no supported jQuery needs.
Removes 26 legacy-browser tests, renames 3, edits the upload progress test and adds 3.
Drops datetime from the clearFields type list. Removes 4 clearInputs and 8 closeKeepAlive tests, and adds 1 that pins the ignored option.
Removes bindDelegated and its always-on warning. Removes 12 delegation: true tests, replaces the empty-string and rewrite-to-true tests with 5 that expect the error, and edits 1 ajaxFormUnbind test.
Removes the File API and FormData detection and its deprecation. Removes 7 tests that reloaded the plugin without them, moves the 8 remaining legacy-jquery tests to plugin-load.test.js, and edits 1 debug-log test.
Edits "should resolve its name to the CommonJS factory" into "should install the module build ... when imported by name".
…s and $.ajax do

- replaces "should resolve the Deferred with the response text, not the parsed data"
- renames "should resolve the Deferred with the response text, success and the xhr"
…ieldValue no longer changes what is sent

- replaces "should be used by formToArray, fieldSerialize and fieldValue when a page overrides it"
- replaces "should skip a control for which an overriding $.fieldValue returns undefined"
- removes the "when a page replaces $.fieldValue" warning tests (8) and "should prefix a deprecation warning with the plugin name", with deprecate()
…nore semantic

Edited or removed tests (4.x behavior):
- serialization: "...non-semantic mode" (now tree order), "append an outside control ... when semantic is true", "named anchors and images when semantic is true", "form-associated custom element ...", "call filtering with each candidate ...", "append the clicked image when it is the only control ...", "append a clicked image from outside the form ...", "order the clicked image in place only when semantic is true"
- serialization-oracle: "formToArray with semantic ..." (removed); ajax-form: "image coordinates when semantic is true" (removed)
- the other semantic-named serialization and submission tests lose the flag and its wording
…r an unnamed one

Edited tests (4.x behavior):
- serialization: "skip image inputs that were not clicked", "include the clicked image value and coordinates", "send the clicked image's fields at its place in tree order", "send the clicked image when it is the only control", "not send a clicked image that is disabled or unnamed" (split), "send an empty value for a clicked image without a value attribute" (replaced), "serialize missing click coordinates as empty values", "send the clicked image in tree order ..."
- ajax-form: "send the point 0,0 for an image passed to requestSubmit", "send the clicked image's coordinates when controls named clk_x and clk_y ..."; iframe-transport: "submit clicked image values and coordinates as hidden inputs"
…native submission does

Edited tests (4.x behavior): serialization "send the literal value of a hidden input named _charset_ and nothing for dirname" (the dirname half moves to the new dirname tests)
…n does

Edited tests (4.x behavior): serialization "send the literal value of a hidden input named _charset_" (now expects UTF-8)
… as a native submission does

Edited tests (4.x behavior): xhr-transport "append an empty string when a multipart form has an empty file input" (now an empty file)
@kevindb kevindb mentioned this pull request Nov 27, 2026
package-lock.json regenerated from the merged package.json.

This branch was successfully deployed

1 active (outdated) deployment
npm — 5349abd9 Deployed Nov 27, 2026 by kevindb via publish #8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant