Skip to content

update jQuery to 3.6 and introduce ES6 - #869

Closed
LordSimal wants to merge 7 commits into
4.xfrom
4.x-jquery-3-6
Closed

LordSimal wants to merge 7 commits into
4.xfrom
4.x-jquery-3-6

Conversation

@LordSimal

Copy link
Copy Markdown
Member

Fixes #868

This updates the jQuery from v1.11.0 to v3.6.0

As you may notice I also introduced ES6 since I asume that we don't support IE11 and already had a prototype class for our toolbar-app.js which is now a proper ES6 class.

The import statements above the JS files are browser native dynamic imports, see HERE

I also adjusted the global variable toolbar to debugKitToolbar to be more specific.

Since we have no real frontend E2E testing here how do we want to test these changes together?

@LordSimal LordSimal added this to the 2.2.x milestone Jun 6, 2022
Comment thread templates/element/history_panel.php Outdated
Comment thread templates/element/history_panel.php Outdated
Comment thread templates/element/history_panel.php Outdated
@ADmad

ADmad commented Jun 6, 2022

Copy link
Copy Markdown
Member

It would be nice if all the JS code in the templates was also moved into JS files and the template would just have a single method call.

LordSimal and others added 4 commits June 6, 2022 14:20
Co-authored-by: ADmad <ADmad@users.noreply.github.com>
Co-authored-by: ADmad <ADmad@users.noreply.github.com>
Co-authored-by: ADmad <ADmad@users.noreply.github.com>
@LordSimal

Copy link
Copy Markdown
Member Author

Seems like I missed a bunch of var in the template files. But yes @ADmad, moving all the JS logic to pure JS files seems a good call and I will do that!

@markstory

Copy link
Copy Markdown
Member

Since we have no real frontend E2E testing here how do we want to test these changes together?

In the past I've manually tested the front-end. Historically browser automation was painful in PHP so I didn't do it. However, in the past few years new libraries like panther have made end to end testing much easier.

Comment thread webroot/js/debug_kit.js
webroot: __debugKitWebroot,
});
let elem = document.getElementById( '__debug_kit_app' );
if( elem ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing in these blocks isn't consistent with the rest of the code, can we make it all formatted the same way? Preferably using a linter/formatter so that we can ensure consistency in the future as well.

Comment thread webroot/js/debug_kit.js
webroot: __debugKitWebroot,
});
let elem = document.getElementById( '__debug_kit_app' );
if( elem ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this formatting the preferred standard for js now? if() { ? usually it's if () {

@ADmad ADmad Jun 8, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should stick to as close as possible to what we use for PHP, so if (..) {.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to get too mired in style nitpicking personally. I can expand the lint task to also check JS and CSS files. I'm thinking of using 'boring' tools like eslint with 'recommended' settings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed using basic eslint was also my plan.
But first I have to do the base work of actually refactoring the current jQuery mess into ES6 modules.
After the functional part is over we can then argue about what JS code styling we use...

@LordSimal

Copy link
Copy Markdown
Member Author

As discussed in the core chat I will refactor the whole frontend part of this project and try to implement eslint as well for the new ES6 JS Modules

@LordSimal LordSimal closed this Jun 8, 2022
@ADmad
ADmad deleted the 4.x-jquery-3-6 branch June 8, 2022 15:42
@LordSimal LordSimal mentioned this pull request Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update to latest version of the JQuery 3.6

5 participants