Skip to content

2.0.0: jQuery 3.5+, removals announced in 1.4, text by default - #42

Draft
kevindb wants to merge 25 commits into
mainfrom
release-2.0
Draft

kevindb wants to merge 25 commits into
mainfrom
release-2.0

Conversation

@kevindb

@kevindb kevindb commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Summary

2.0.0: removes what 1.4 announced with deprecation notices, inserts values as text by default, and
fixes the three bugs whose fixes change output. Stays a draft until the release; the version is
2.0.0-dev until then.

 $.fn.loadJSON(data, options)
-  installContains()                      # Array.prototype.contains
-  if string and not { or [ → $.ajax(url) # URL argument
+  string → JSON.parse (a URL throws SyntaxError)
   useSavedTemplate
-    data never saved unless set to null/""
+    saved on the first call, restored on each later one
   walk
     match(key, scope)
-      class → id → name → rel (whole page)
+      class → id → name, key escaped with $.escapeSelector
     walkArray
-      rel="index" children
       select / checkbox group / repeat
     element kinds
-      content: .html(value)
+      content: .text(value), or .html(value) with { html: true }
-      image: top-level src/alt/title fallback
+      image: object → src/alt/title, anything else → src
-      link: ?key=value
+      link: ?encodeURIComponent(key)=encodeURIComponent(value)
-      refreshMobile(selectmenu / checkboxradio)
-  $.fn.loadJSON.debug, src/legacy.js

Packaging:

-"dependencies": { "jquery": ">=1.7" }
+"peerDependencies": { "jquery": ">=3.5" }
+"exports": {
+  ".": { "import": "./dist/jquery.loadJSON.mjs", "default": "./dist/jquery.loadJSON.js" },
+  "./dist/jquery.loadJSON.js", "./dist/jquery.loadJSON.mjs", "./dist/jquery.loadJSON.min.js",
+  "./package.json"
+}
-bower.json
 composer.json: components/jquery >=3.5

CI matrix: jQuery 3.5.1, 3.7.1 and 4.0.0 (was 1.7.2, 3.7.1, 4.0.0) on Chromium, Firefox and WebKit.

Docs: docs/migrating-to-2.md (each 1.4 notice quoted, with its replacement), guides rewritten
for 2.0, docs/debugging.md removed, the two connected-select examples load each select directly.

Evidence

  • Before: the suite run against the src/ published as 1.4.0: 125/125 (jQuery 3.7.1 and 4.0.0).
    After: this branch's suite against 1.4.0: 19 failures on jQuery 3.7.1, 18 on 4.0.0, each a
    2.0 change with a migration guide entry; on this branch: 133/133 per browser, no it.fails
    left, 100% coverage; jQuery 3.5.1 / 3.7.1 / 4.0.0 × Chromium / Firefox / WebKit and the end-to-end
    tests pass locally.
  • New surface tests (test/surfaces/exports.test.js) resolve with Node, as import and require:
    jquery-load-json → .mjs / classic build; the three dist files and package.json resolve;
    src/*.js, dist/jquery.loadJSON and the source map give ERR_PACKAGE_PATH_NOT_EXPORTED.
    With the exports map removed, five of them fail.
  • The bundler surface test (rolldown) and the README SRI test still pass.

Merge Danger

Door: two-way until the tag; one-way once 2.0.0 is on npm.

Merging alone publishes nothing; the release is a separate tag and approval. After 2.0.0 is
published, its behavior can only be changed by later versions, and 1.x fixes come from
release/1.x.

Blast Radius: consumers

Every user who upgrades across the major: values that held markup show as text, URL arguments
throw, rel templates stop matching, a second load restores the template (handlers bound inside it
since the first call are lost), deep imports of src/ stop resolving, and jQuery below 3.5 is
unsupported. ^1 ranges are unaffected.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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