WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 6 days ago

#50564 new task (blessed)

Update jQuery step two

Reported by: azaozz Owned by:
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: External Libraries Keywords: early has-patch needs-testing
Focuses: javascript Cc:

Description (last modified by desrosj)

Follow up from #37110.

Update to latest jQuery, latest jQuery Migrate, latest jQuery UI.

This ticket represents step 2 in the following roadmap for updating jQuery to 3.x in Core: https://make.wordpress.org/core/2020/06/29/updating-jquery-version-shipped-with-wordpress/

Attachments (1)

50564.diff (741.1 KB) - added by azaozz 2 weeks ago.

Download all attachments as: .zip

Change History (15)

#1 @desrosj
2 months ago

  • Description modified (diff)
  • Keywords needs-patch added

Adding the blog post on Make Core to the ticket description for full context.

#2 follow-up: @mgol
7 weeks ago

One thing that may be important here - while we (the jQuery Core team) generally try to follow semver right now and only do breaking changes in major releases, we had to do a breaking change in 3.5 to resolve a security issue. Details on that change are included in the 3.5 upgrade guide: https://jquery.com/upgrade-guide/3.5/.

Note that Migrate will not automatically restore previous behavior here as we prefer Migrate to not reintroduce security issues by default. If this upgrade is too much for you to do at once, you can call:

jQuery.UNSAFE_restoreLegacyHtmlPrefilter();

as indicated in the upgrade guide. This is a Migrate API so it's only available if you load a new enough Migrate version.

Version 0, edited 7 weeks ago by mgol (next)

This ticket was mentioned in Slack in #core by mgol. View the logs.


7 weeks ago

This ticket was mentioned in Slack in #core by desrosj. View the logs.


5 weeks ago

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.


4 weeks ago

This ticket was mentioned in Slack in #core by helen. View the logs.


4 weeks ago

#7 @TimothyBlynJacobs
4 weeks ago

Just sharing a comment I made in the dev chat:

If we upgrade to jQuery 3.0 do we anticipate using any jQuery 3.0 features? Or if WordPress Core won't be reliant on jQuery Migrate, ie we wouldn't be using any deprecated features, will that be possible to do while maintaining jQuery 1.x compatibility?

If we do anticipate needing to use jQuery 3 features, I think it’d leave people currently relying on the jQuery Migrate plugin without a path forward to the latest core. It would also mean plugin authors probably wouldn’t be able to safely use jQuery 3.0 features.

#8 in reply to: ↑ 2 @azaozz
4 weeks ago

Replying to mgol:

Note that Migrate will not automatically restore previous behavior here as we prefer Migrate to not reintroduce security issues by default.

Thanks for the clarification. Thinking it would be best if the WP implementation leaves this out for now, i.e. keeps the security fix. Then, if there are (lot of) problems during testing of WP 5.6, enable it temporarily for one release cycle.

@TimothyBlynJacobs:

If we upgrade to jQuery 3.0 do we anticipate using any jQuery 3.0 features?

This is a "tough question", but something we'll have to go through. A good, backwards compatible way seems to be to not use any jQuery 3.x features for (at least) the release cycle when jQuery is updated, i.e. start using them in WP 5.7. That gives plenty of time to everybody to update their code.

WP 5.7 is also the time to fix/refactor all core js to work without jQuery Migrate 3.x. Currently there are several scripts that are not compatible. This will also be the most "breaking" step for old plugins and themes, and will probably need some safeguards in order to do it right.

Last edited 4 weeks ago by azaozz (previous) (diff)

This ticket was mentioned in Slack in #core by sergey. View the logs.


4 weeks ago

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


3 weeks ago

@azaozz
2 weeks ago

#11 @azaozz
2 weeks ago

  • Keywords has-patch needs-testing added; needs-patch removed

In 50564.diff:

  • Update jQuery to 3.5.1, and jQuery Migrate to 3.3.1.
  • Update jQuery UI to 1.12.1. This also brings jQuery UI in the core repository (vs. adding it from "node_modules") as the build process in UI 1.12.1 has changed quite a bit and doesn't match how it is used/enqueued in WP.

To keep backwards compatibility the (pre-built) jquery-ui.js was split in three parts:

  • All effects are concatenated in a (new) jquery/ui/effects.js.
  • All files from "group: Core" are concatenated in /ui/core.js. That also contains 'jquery-ui-position' and 'jquery-ui-widget'.
  • The files from "group: Widgets" and "group: Interactions", like draggable.js, droppable.js, sortable.js, etc. are still enqueued separately to optimize loading.
Last edited 12 days ago by azaozz (previous) (diff)

#13 @azaozz
12 days ago

(The above PR is fresher than 50564.diff.)

@ocean90 Seems you've last worked on adding/updating jQuery UI in core. Could you have a look please, mostly at the UI part :)

Looks like the old UI files in WP can be loaded using AMD. Wondering if WP should try to maintain that after the changes in the UI sources in 1.12.1?

Last edited 12 days ago by azaozz (previous) (diff)

#14 @desrosj
6 days ago

  • Type changed from defect (bug) to task (blessed)

Changing this to a task to more accurately reflect what's happening here.

Note: See TracTickets for help on using tickets.