Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jQuery 4.x as additional option #6404

Open
indigoxela opened this issue Feb 13, 2024 · 11 comments · May be fixed by backdrop/backdrop#4657
Open

Add jQuery 4.x as additional option #6404

indigoxela opened this issue Feb 13, 2024 · 11 comments · May be fixed by backdrop/backdrop#4657

Comments

@indigoxela
Copy link
Member

indigoxela commented Feb 13, 2024

The first 4.x Beta for jQuery has been published recently.

It brings several changes that affect core code. We should start to prepare for a stable 4.x release.

Are we there, yet? Short answer: no.

We have some (not many) usages of deprecated (and removed in 4) functions, covered in #6248 👈 I'd suggest to start there.

We have to decide on a strategy with third party code that isn't compatible anymore and isn't maintained anymore:

While we might consider to just drop jquery.cookie.js and possibly jquery.timeentry.js, that's no option for jquery.form.js.
Note that Drupal struggles with a similar problem: https://www.drupal.org/project/drupal/issues/3419734 Let's keep an eye on their considerations.

@indigoxela
Copy link
Member Author

indigoxela commented Feb 13, 2024

Another idea: fix all problems in our own code, then check which removed jQuery functions are missing re 3rd party stuff and provide those functions as bc-layer in core, or use jquery-migrate.

I know, that's just postponing the problem, but... that would allow us to integrate jQuery v4 faster without having to fork the unmaintained stuff, or even decide whether we should fork.

@indigoxela
Copy link
Member Author

indigoxela commented Feb 13, 2024

A little overview re 3rd party scripts:

jQuery.isArray
core/misc/jquery.form.js

jQuery.isFunction
core/misc/jquery.form.js
core/misc/jquery.timeentry.js

jQuery.isNumeric
core/modules/system/js/jquery.treetable.js

jQuery.trim
core/modules/system/js/jquery.treetable.js
core/misc/jquery.cookie.js

So there are 4 incompatible scripts (one of them not in use in core), relying on 4 deprecated/removed functions.
... removed in jQuery 4 (couldn't resist the pun).

@indigoxela
Copy link
Member Author

A PR is available to play with.

To see jQuery 4 in action, go to admin/config/development/jquery, check "jQuery 4 (experimental)" and save.

On that same page you can open a browser console and run jQuery.fn.jquery. That will output "4.0.0-beta".

Click around, do some AJAX stuff (with nodes, fields, layouts, views...). In theory everything works.
Nothing's decided, yet, and there are many open questions.

  • Do we want such a bc layer for plugins?
  • More of it? (Bring back more of those removed utility functions?)
  • Do we want yet another jQuery version to choose from on admin/config/development/jquery?
  • What do we do with v5, v6...?
  • When do we want to make v4 available in Backdrop?
  • ...

As jQuery 4 is still Beta, anyway, we have some time to make up our minds.

@klonos
Copy link
Member

klonos commented Feb 14, 2024

Thank you @indigoxela 🙏🏼 ❤️

I don't have all the answers to the above questions, but here are some thoughts:

Do we want yet another jQuery version to choose from on admin/config/development/jquery?

I can't think any reason why that would be a problem. That form is not "busy", and besides, people would only visit that once every so to configure the version they want, then forget about it if their site works fine.

What do we do with v5, v6...?

We should add telemetry on this, then as new versions of jQuery are coming out and older ones get deprecated/EoL'ed we can consider removing/adding versions as needed. We can change the default for new installations as soon as one version has been tested enough and any bugs have been surfaced/squashed. And finally, we can consider moving old versions to contrib.

When do we want to make v4 available in Backdrop?

As soon as there's a stable release I think. We can still keep it with the "experimental" indication, and leave v3 as the default. Then as we get more confident, we can change the default to v4 in a future core release. How confidence will be gained:

...we have some time to make up our minds.

Yes 👍🏼 ...and even if v4 stable gets released, we don't have to rush then either.

@indigoxela
Copy link
Member Author

@klonos many thanks for your thoughts, that's mostly, what I had in mind. 🙏

Another thing to keep in mind: contrib. Many modules aren't even fully compatible with 3.x, yet. So I think, there's still a way to go, before we could consider switching the default (for new sites) to 4.x. But as you stated - no need to rush.

@indigoxela
Copy link
Member Author

Something else to consider re my proposal to add a (small) bc layer for jQuery 4: contrib projects.

I'd assume, that many contrib modules aren't fully compatible with jQuery 3, yet, let alone jQuery 4.
By providing that layer, we'd enable these projects to be used with v4 without breaking them. However, currently the bc layer contains only the required functions for (3rd party) plugins used in core, not all removed functions.

@indigoxela
Copy link
Member Author

Time for a rebase - done. 😉

Currently the jQuery 4.0.0 milestone has only one open issue. But, of course, there's no due date. But let's keep an eye on it.

@indigoxela
Copy link
Member Author

indigoxela commented May 16, 2024

Oh, jQuery.UI got updated: https://blog.jqueryui.com/2024/05/jquery-ui-1-14-0-beta-1-released/
Seems like it was also tested against the jQuery 4.x dev branch, which is good news. Although I think, it was compatible before, this makes sure, jQuery.UI plays nicely with v4.

@indigoxela
Copy link
Member Author

Rebased to get back a PR sandbox - for a very short time. 😉

@indigoxela
Copy link
Member Author

indigoxela commented Jul 18, 2024

They just announced the release of a Second Beta of jQuery 4.0.0.

Most of the changes seem related to test and build infrastructure: https://github.com/jquery/jquery/releases/tag/4.0.0-beta.2

On Mastodon it seems like they're leaning towards "RC next"? Maybe... https://social.lfx.dev/@jquery/112803865842862230 😉

So I updated my experimental PR - it needed another rebase, anyway. Happy testing in the fresh sandbox!

@izmeez
Copy link

izmeez commented Sep 22, 2024

For anyone else, like me, wondering what jquery 4 brings here is a post that may help, https://medium.com/@alexefimenko/jquery-4-a-new-era-3695332777ef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants