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: https://petitions.classicpress.net/posts/187/jquery-to-vanilla-js

Author: Lodder

Vote count: 31

Status: open


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.


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);

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