CSP-safe callbacks + jQuery 3.7.1 / Migrate 3.4.1 + cleanup (v1.9.1) - #35
Merged
Conversation
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.
There was a problem hiding this comment.
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-saferesolveFn()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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) viaeval(), which throws under a strict Content-Security-Policy that disallows'unsafe-eval'.Replaced with a CSP-safe
resolveFn()helper that:$.layout.callbacksregistry, thenwindow(noeval/new Function).Applied to
runPluginCallbacksand_runCallbacksin all three active builds (unminified + minified):source/stable/jquery.layout_and_plugins.js(+.min.js)dist/jquery.layout_and_plugins.js(+.min.js) — the npmmaindemos/js/jquery.layout_and_plugins.js(+.min.js)Verified: 0
eval()callback usages remain. (The bundled Persist.js state store already usesJSON.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.jsonregenerated to match.jquery-3.7.1.*andjquery-migrate-3.4.1.*(+ maps) intodemos/js; refreshed genericjquery.js/.min.jsandjquery-migrate.js/.min.js/.min.map.jquery-3.5.1.js -> jquery-3.7.1.js.3. Cleanup of older versions
Removed
source/versions/,source/dev/,source/jquery/, and olddemos/jsjQuery/Migrate/layout duplicates (jquery-2.js,jquery-3.5.0*,jquery-3.5.1.js,jquery-migrate-3.3.0*, the 1.6.2jquery.layout.js/.min.js).Versioning
Bumped to 1.9.1 in
package.json,package-lock.json, internal$.layout.version, and README changelog (above the existing1.9.0tag).