jQuery to vanilla JS

I’m going to propose that the core of ClassicPress be rewritten using vanilla Javascript.

Please note that I’m NOT suggesting dropping jQuery. The file will still reside in the product to allow plugin developer to use it if they wish.

The benefits of moving to vanilla Javascript:

  1. Massive runtime performance increase
  2. Less http requests
  3. No B/C break when updating jQuery

If this is done correctly, there will be no B/C breaks and all plugins that depend on any core Javascript will still work in exactly the same manner.


Read-only archive: Issues · ClassicPress/ClassicPress · GitHub

Author: Lodder

Vote count: 31

Status: open


Comments

1 Like

This petition had 31 votes and an active discussion on Github. Seems like a good idea but a monumental effort. CP still uses jQuery v1 and I see there’s an effort to backport v3 from WP. So is this still a viable option/petition?

If we would have the people who actually know JS, with the time needed, we probably could do this.

Personally, if I use any JS like/related language, then jQuery much much more than plain JS mainly because if I use, then because it is inside a jQuery UI instance.
But that is just because it is “there”. If there is a similar pendant for plain JS or else, I would use that.

However core is massively relying on jQuery. Like massively. The entire Customizer, Media, every single bit of the user interface, its all jQuery, not plain JS
This is like writing a new CMS I believe. Good idea, but we need:

  • several fully committed people who (truly) can write JavaScript
  • a considerable amount of time

If we have that, I think it probably would be a cool thing. But I don’t think we have any of those resources.
We barely manage to (copy) write a documentation :slight_smile: or do simple enhancements that are pending in Git since quite a while.
Thus probably I would keep it open but not put on any “must do” list.

4 Likes

I think a better first step is to move CP from using jQuery v1 to v3. I have already done that on many of my own sites and I haven’t had any issues (using a variation on this basic code to host v3 locally):

wp_deregister_script( 'jquery' );
wp_enqueue_script( 'jquery', 'xxx/jquery-3.6.0.min.js', null, null, true);
3 Likes

@anon66243189 is working on backporting jQuery v3 right now, so that’s already in progress.

3 Likes

That’s an anon user now. So this seems to be an outdated truth (hence now false.)

I agree with Tim on updating to jQuery 3. In theory, it sounds all nice… just make everything vanilla!, but who is gonna do that?

I would close this petition, which doesn’t mean we are against it. By all means, if someone wants to do it, go for it. The cool part of the story is, it can be done in chunks. Someone may want to “translate” a certain feature into Vanilla and submit a PR. This is something that doesn’t require a petition because it’s a clear improvement as long as it doesn’t break anything.

What I would do instead is, add to the potential roadmap a “Update Admin Area to jQuery 3”. Choosing jQuery for a new project may be a bad idea to a certain degree, but maintaining something that’s already jQuery doesn’t sound crazy to me. It’s a good and powerful JS library.

What I don’t know is… where is that potential roadmap? Will it be the output of the upcoming discussion? (it should be.)

Beda was the one working on upgrading jQuery to v3 . He did get a lot of the work completed, but got stuck on something.

This petition can be closed since it’s for vanilla JS.

1 Like

Close (don’t need it, close it)

This is a monumental effort with very little returns in terms of performance and a huge con in form is code readibility.

1 Like

This topic was automatically closed after 3 days. New replies are no longer allowed.