Skip to content

1.4.0: tests, modern tooling, jQuery 4 support and fixes - #39

Merged
kevindb merged 68 commits into
mainfrom
release-1.4
Nov 13, 2026
Merged

kevindb merged 68 commits into
mainfrom
release-1.4

Conversation

@kevindb

@kevindb kevindb commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

1.4.0: a non-breaking release. Same $.fn.loadJSON(data, options) API, same jQuery support (1.7+), now also jQuery 4. It supersedes 1.3.4, which was tagged on GitHub but never published to npm.

Summary

 src/
-└── jquery.loadJSON.js     # classic UMD, one file
+├── jquery.loadJSON.js     # entry: arguments, saved template, callbacks, the walk
+├── element-kinds.js       # how a value is set on each element kind
+├── key-match.js           # a key's match: class, then id, then name, then rel
+└── legacy.js              # behavior 2.0 removes, and the deprecation notices
 dist/                      # built by Rollup, committed, checked against the build in CI
+├── jquery.loadJSON.js     # classic UMD: script tag, AMD, CommonJS (root, jQuery) factory
+├── jquery.loadJSON.mjs    # module build
 └── jquery.loadJSON.min.js (+ .map)

Fixes, compared with 1.3.3 on npm:

  • jQuery 4: a JSON string argument works again (JSON.parse instead of the removed $.parseJSON), and CommonJS without a window builds jQuery 4 from jquery/factory.
  • Arrays: loading an array into the element itself repeats it instead of throwing (bugfix: DOM element selection when loading a JSON Array #28, thanks to Francesco Angi).
  • Selects: an array by key appends options or selects values instead of throwing; a select uses its own values; a scalar selects in a multiple select with one option; a scalar into a multiple select with no options no longer throws.
  • Images: a string value sets src; {src, alt, title} sets all three on that image.
  • Links: the parameter goes before a #fragment, and an href that is only a query gets &.
  • Keys that are not valid selectors (a class starting with a digit, a name containing a quote, a:b() match by attribute instead of throwing or missing.
  • null values are skipped instead of throwing.
  • Array.prototype.contains is no longer enumerable, so it stays out of for...in loops.
  • Bundlers use the module build: import "jquery-load-json" registers the plugin. The browser field pointed bundlers that read it first at the classic build, which never registered it.

New: $.fn.loadJSON.debug = true shows a console warning, once per page, for each behavior 2.0 removes (docs/debugging.md). Off by default, so output is unchanged.

Project: tests, Rollup build, ESLint and Prettier, CI on jQuery 1.7.2, 3.7.1 and 4.0.0 in Chromium, Firefox and WebKit, CodeQL, a release workflow publishing to npm through trusted publishing with provenance, docs in docs/ with working examples, SRI hashes on the CDN snippets, license id LGPL-2.1-or-later, jquery back to >=1.7 as on npm today.

Evidence

  • Before (1.3.3 from npm, same suite): jQuery 3.7.1: 94 pass, 31 fail; jQuery 4.0.0: 89 pass, 36 fail. Every failure is one of the fixes or additions above; no test passes on 1.3.3 and fails on 1.4.0.
    After: npm test passes: 143 tests, 100% statement, branch, function and line coverage (enforced), and the four bugs left for 2.0 recorded as expected failures. All 9 jQuery x browser cells and the end-to-end tests pass in CI.
  • Before: a bundler reading browser first (rolldown) bundled the classic build, and typeof $.fn.loadJSON was "undefined".
    After: it bundles dist/jquery.loadJSON.mjs, and typeof $.fn.loadJSON is "function" (test/surfaces/bundlers.test.js).
  • Package: 11 files, 31.1 kB packed (the 1.3.4 tag: 127 files, 573 kB). Minified build 6.9 kB, 3.1 kB gzipped.

Merge Danger

Door: two-way

Merging publishes nothing; the v1.4.0 tag does, after approval. Once on npm, 1.4.0 cannot be unpublished and republished under the same version; a regression ships as 1.4.1.

Blast Radius: consumers

  • main moves from src/ to dist/jquery.loadJSON.js. A deep import of src/jquery.loadJSON.js now gets an ES module that imports its sibling files.
  • Pages that relied on a fixed bug (an option per character of an array string, images ignoring their own value, unescaped keys missing) see the intended result instead.
  • GitHub Pages starts serving docs/ and the examples from main.

🤖 Generated with Claude Code

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

…b Pages

GitHub Pages serves only docs/; CI checks the copy matches dist/.
Ports eight of the old examples; the Bing Maps and jQuery Mobile pages are not ported.
The old examples/ ignore pattern also matched docs/examples/, so Prettier had skipped them.
docs/examples replaces them; this clears the code-scanning alerts they raised.
@kevindb
kevindb marked this pull request as ready for review November 13, 2026 04:20
@kevindb
kevindb merged commit e89f3d8 into main Nov 13, 2026
13 checks passed
@kevindb
kevindb deleted the release-1.4 branch November 13, 2026 04:36
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.

2 participants