jquery-4-migrationlisted
Install: claude install-skill JMAILLY/claude-migration-skills
# jQuery 3 → jQuery 4 migration (Drupal theme)
Drupal 11 ships jQuery 4. All APIs deprecated since jQuery 3.x are
**permanently removed**. Custom JS (typically under
`web/themes/custom/<theme>/src/js/`) must be migrated. This works
independently of the core bump: native replacements (`Array.isArray`,
`String.prototype.trim`, `Date.now`…) exist regardless of the jQuery version, so
you can migrate and test **while still on Drupal 10** (jQuery 3.x + polyfill).
## Golden rule: everything goes through the Makefile
Never run `npm`/`gulp` directly on the host — use the targets inside the node
container:
| Need | Make target |
|---|---|
| Build assets | `make npm-build` |
| Deploy built assets | `make gulp-deploy` |
| Clear Drupal cache | `make cr` |
| Shell in a container | `make shell` |
## The polyfill: understand before acting
Many D10 projects include a **polyfill** re-implementing removed jQuery
functions (`jquery-deprecated.js` / `polyfill.js`). Its presence means:
1. Theme code likely still depends on these APIs.
2. Two strategies:
- **(A) Keep the polyfill** temporarily, migrate the calling code
progressively, remove it at the end. Safest — **recommended**.
- **(B) Migrate everything to native APIs and remove the polyfill** at once.
Cleaner but riskier.
Start with (A); remove the polyfill once `grep` confirms zero remaining usages.
## Removed API conversion table
| Removed API | Native / jQuery 4 replacement |
|---|---|
| `$.isFunction(x)` / `$.fn.i