Skip to content

CSP-safe callbacks + jQuery 3.7.1 / Migrate 3.4.1 + cleanup (v1.9.1) - #35

Merged
GedMarc merged 1 commit into
masterfrom
feat/csp-jquery-3.7.1-migrate-3.4.1
Jul 23, 2026
Merged

CSP-safe callbacks + jQuery 3.7.1 / Migrate 3.4.1 + cleanup (v1.9.1)#35
GedMarc merged 1 commit into
masterfrom
feat/csp-jquery-3.7.1-migrate-3.4.1

Conversation

@GedMarc

@GedMarc GedMarc commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Makes jquery.layout CSP-compliant, upgrades to the latest jQuery 3.x + Migrate, and removes stale versions. Released as 1.9.1.

1. CSP compliance (remove eval())

The plugin resolved string callbacks (e.g. onopen_end: myApp.onOpen) via eval(), which throws under a strict Content-Security-Policy that disallows 'unsafe-eval'.
Replaced with a CSP-safe resolveFn() helper that:

  • first checks the $.layout.callbacks registry, then
  • walks a dotted function-name path on window (no eval / new Function).
    Applied to runPluginCallbacks and _runCallbacks in all three active builds (unminified + minified):
  • source/stable/jquery.layout_and_plugins.js (+ .min.js)
  • dist/jquery.layout_and_plugins.js (+ .min.js) — the npm main
  • demos/js/jquery.layout_and_plugins.js (+ .min.js)
    Verified: 0 eval() callback usages remain. (The bundled Persist.js state store already uses JSON.parse.)

2. jQuery 3.7.1 (latest 3.x) + Migrate 3.4.1

  • package.json: jquery ^3.7.1, jquery-migrate 3.4.1 (pinned); package-lock.json regenerated to match.
  • Vendored jquery-3.7.1.* and jquery-migrate-3.4.1.* (+ maps) into demos/js; refreshed generic jquery.js/.min.js and jquery-migrate.js/.min.js/.min.map.
  • Updated all demo HTML script refs jquery-3.5.1.js -> jquery-3.7.1.js.

3. Cleanup of older versions

Removed source/versions/, source/dev/, source/jquery/, and old demos/js jQuery/Migrate/layout duplicates (jquery-2.js, jquery-3.5.0*, jquery-3.5.1.js, jquery-migrate-3.3.0*, the 1.6.2 jquery.layout.js/.min.js).

Versioning

Bumped to 1.9.1 in package.json, package-lock.json, internal $.layout.version, and README changelog (above the existing 1.9.0 tag).

Remove eval() from layout core; resolve string callbacks via CSP-safe resolveFn (checks $.layout.callbacks then dotted global path) so Layout runs under strict CSP without unsafe-eval. Applied to source/stable, dist and demos/js builds (min + unmin).
Upgrade jQuery to 3.7.1 (latest 3.x) and jQuery Migrate to 3.4.1; update package.json (pin migrate 3.4.1) and package-lock.json; refresh demos/js vendored files and demo HTML script refs.
Bump version to 1.9.1 (package.json + internal $.layout.version).
Remove stale versions: source/versions, source/dev, source/jquery and old demos/js jQuery/Migrate/layout duplicates.
Copilot AI review requested due to automatic review settings July 23, 2026 03:43
@GedMarc
GedMarc merged commit 670230a into master Jul 23, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates jquery.layout to v1.9.1 with a focus on making callback resolution CSP-safe (removing eval()-based string callback execution), upgrading bundled jQuery (3.7.1) and jQuery Migrate (3.4.1) for demos/npm packaging, and cleaning out older/stale source/version directories and duplicates.

Changes:

  • Replaced eval()-based string callback resolution with a CSP-safe resolveFn() helper in the active “layout_and_plugins” builds (source/dist/demos).
  • Bumped versions to 1.9.1 and updated npm dependencies + regenerated package-lock.json (lockfile v3).
  • Updated demo HTML script references to jQuery 3.7.1 / Migrate 3.4.1 and removed legacy/stale plugin/version files.

Reviewed changes

Copilot reviewed 29 out of 79 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
source/versions/plugins/jquery.layout.state-1.0.min.js Removed stale historical plugin build as part of repo cleanup.
source/versions/plugins/jquery.layout.state-1.0.js Removed stale historical plugin source as part of repo cleanup.
source/versions/plugins/jquery.layout.slideOffscreen.min-1.1.js Removed stale historical plugin build as part of repo cleanup.
source/versions/plugins/jquery.layout.slideOffscreen-1.1.js Removed stale historical plugin source as part of repo cleanup.
source/versions/plugins/jquery.layout.resizeTabLayout-1.3.min.js Removed stale historical callback build as part of repo cleanup.
source/versions/plugins/jquery.layout.resizeTabLayout-1.3.js Removed stale historical callback source as part of repo cleanup.
source/versions/plugins/jquery.layout.resizePaneAccordions-1.2.min.js Removed stale historical callback build as part of repo cleanup.
source/versions/plugins/jquery.layout.resizePaneAccordions-1.2.js Removed stale historical callback source as part of repo cleanup.
source/versions/plugins/jquery.layout.resizeDataTable.min-1.0.js Removed stale historical callback build as part of repo cleanup.
source/versions/plugins/jquery.layout.resizeDataTable-1.0.js Removed stale historical callback source as part of repo cleanup.
source/versions/plugins/jquery.layout.pseudoClose.min-1.1.js Removed stale historical callback build as part of repo cleanup.
source/versions/plugins/jquery.layout.pseudoClose-1.1.js Removed stale historical callback source as part of repo cleanup.
source/versions/plugins/jquery.layout.plugins-1.0.min.js Removed stale historical “plugins bundle” build as part of repo cleanup.
source/versions/plugins/jquery.layout.plugins-1.0.js Removed stale historical “plugins bundle” source as part of repo cleanup.
source/versions/plugins/jquery.layout.buttons-1.0.min.js Removed stale historical plugin build as part of repo cleanup.
source/versions/plugins/jquery.layout.buttons-1.0.js Removed stale historical plugin source as part of repo cleanup.
source/versions/plugins/jquery.layout.browserZoom-1.0.js Removed stale historical plugin source as part of repo cleanup.
source/stable/jquery.layout_and_plugins.js Introduced CSP-safe callback resolution (resolveFn) and updated internal version/revision to 1.9.1.
source/jquery/jquery-migrate-1.2.1.js Removed very old vendored Migrate version as part of cleanup.
source/dev/plugins/jquery.layout.touch-1.0.js Removed legacy dev plugin source as part of cleanup.
source/dev/plugins/jquery.layout.state-1.1.js Removed legacy dev plugin source as part of cleanup.
README.md Added 1.9.1 changelog entry documenting CSP change + dependency bumps + cleanup.
package.json Bumped package version to 1.9.1 and updated dependencies (jQuery ^3.7.1, Migrate 3.4.1 pinned).
package-lock.json Regenerated lockfile for new versions; upgraded to lockfileVersion 3.
dist/jquery.layout_and_plugins.js Updated distributed unminified build to include CSP-safe callback resolution + 1.9.1 version bump.
demos/tabs_basic.html Cleaned up demo script tags (removed commented legacy jQuery 2 reference).
demos/swap_panes.html Updated demo to reference jQuery 3.7.1.
demos/simple.html Updated demo to reference jQuery 3.7.1.
demos/saved_state.html Updated demo to reference jQuery 3.7.1.
demos/saved_state_nested.html Updated demo to reference jQuery 3.7.1.
demos/nested.html Updated demo to reference jQuery 3.7.1.
demos/layouts_inside_tabs.html Updated demo to reference jQuery 3.7.1.
demos/layout_inside_tab.html Updated demo to reference jQuery 3.7.1.
demos/layout_inside_dialog.html Updated demo to reference jQuery 3.7.1.
demos/js/jquery.layout_and_plugins.js Updated demo build to include CSP-safe callback resolution + 1.9.1 version bump.
demos/js/jquery-migrate.min.js Updated bundled “generic” demo migrate file to 3.4.1 minified content.
demos/js/jquery-migrate-3.4.1.min.map Added source map for Migrate 3.4.1 minified demo asset.
demos/js/jquery-migrate-3.4.1.min.js Added Migrate 3.4.1 minified demo asset.
demos/js/jquery-migrate-3.4.1.js Updated unminified Migrate demo asset version markers/content to 3.4.1.
demos/js/jquery-migrate-3.3.0.min.js Removed old bundled Migrate 3.3.0 minified asset.
demos/flexible_height_columns.html Updated demo to reference jQuery 3.7.1.
demos/destroy2.html Updated demo to reference jQuery 3.7.1.
demos/destroy.html Updated demo to reference jQuery 3.7.1.
demos/custom_togglers.html Updated demo to reference jQuery 3.7.1.
demos/container.html Updated demo to reference jQuery 3.7.1.
demos/container_centered.html Updated demo to reference jQuery 3.7.1.
demos/basic.html Updated demo to reference jQuery 3.7.1.
demos/accordions_and_tabs_inside_layout.html Updated demo to reference jQuery 3.7.1.
demos/accordion.html Updated demo to reference jQuery 3.7.1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +68 to +78
, resolveFn = function (name) {
if (typeof name !== "string") return name;
var reg = $.layout.callbacks;
if (reg && typeof reg[name] === "function") return reg[name];
var parts = name.split("."), fn = window, i = 0;
for (; i < parts.length; i++) {
if (fn == null) return undefined;
fn = fn[parts[i]];
}
return fn;
}
Comment on lines +68 to +78
, resolveFn = function (name) {
if (typeof name !== "string") return name;
var reg = $.layout.callbacks;
if (reg && typeof reg[name] === "function") return reg[name];
var parts = name.split("."), fn = window, i = 0;
for (; i < parts.length; i++) {
if (fn == null) return undefined;
fn = fn[parts[i]];
}
return fn;
}
Comment on lines +60 to +64
* CSP-safe replacement for eval().
* Resolves a callback that was passed as a STRING - either a key registered
* in $.layout.callbacks, or a (dotted) function-name on the global object.
* This avoids eval()/new Function(), so Layout works under a strict
* Content-Security-Policy (no 'unsafe-eval' required).
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