Skip to content

Conversation

@roykho
Copy link
Contributor

@roykho roykho commented Feb 5, 2021

All Submissions:

Changes proposed in this Pull Request:

This PR updates WooCommerce for compatibility with jQuery 3 in preparation of the removal of jQuery Migrate in a future version of WordPress.

closes #28284 #28286

For reference, I am using this documentation here https://jquery.com/upgrade-guide/3.0/ and here https://github.com/jquery/jquery-migrate/blob/master/warnings.md

How to test the changes in this Pull Request:

IMPORTANT NOTE

It is quite difficult or not feasible to test every line changes. You may not even know how or where to try and produce the results. We can only test everything we do know such as critical flows and little tidbits.

There are some gotchas that I've found and will document that here p7bje6-2VM-p2#comment-5896.

  1. Install this plugin and disable jQuery Migrate.
  2. Open your browser's javascript console and look for errors while testing the critical flows.
  3. Go through the critical flows in WooCommerce and verify that they still function.

Changelog entry

Fix - Migrate deprecated jQuery 3 functions.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2021

📦 Artifacts ready for download!

Base automatically changed from master to trunk February 25, 2021 22:18
@jonathansadowski
Copy link
Contributor

jonathansadowski commented Feb 26, 2021

I pushed a few commit fixing things I found as I was going through this...

I double-checked all of the .bind() and .data() calls, and I think I caught the rest of them... except for a usage of .data() in add-to-cart.js here:

$.each( $thisbutton.data(), function( key, value ) {
data[ key ] = value;
});

I'm not really sure how to address that in a way that would be backwards-compatible without essentially including the entire part of jQuery Migrate that handles data compatibility. If anybody happens to set data using $().data('some-key-with-dashes'), it'll be stored on the data object with the key someKeyWithDashes, and there's not really a clean was to reverse that without just storing that key as well when it's set.

I gave the JS and PHP files another pass — I want to run through them one more time to make sure that nothing was missed.

I also want to give the e2e tests a go with the Test jQuery Update plugin installed to see if they catch anything that I might have missed.

@jonathansadowski jonathansadowski force-pushed the fix/issue-28284 branch 2 times, most recently from 08278df to 1701a04 Compare April 13, 2021 04:07
@rrennick
Copy link
Contributor

@roykho @jonathansadowski The two source E2E failures are creating shipping methods/zones and order search. Let me know if you'd like me to investigate.

roykho added 22 commits April 28, 2021 16:21
@jonathansadowski jonathansadowski marked this pull request as ready for review April 29, 2021 02:58
@jonathansadowski jonathansadowski requested review from a team and ObliviousHarmony and removed request for a team April 29, 2021 02:58
Copy link
Contributor

@ObliviousHarmony ObliviousHarmony left a comment

Choose a reason for hiding this comment

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

Thanks for the great work here, this was a gargantuan effort.

To test this PR I set up a site locally with the plugin disabling jQuery Migrate. I was able to successfully run the E2E suite. After it passed a few compatibility tests as well, I'm happy to report that this PR looks like it works.

After reviewing the code as well, I'm ready to approve it!

@ObliviousHarmony ObliviousHarmony added this to the 5.4.0 milestone May 10, 2021
@ObliviousHarmony ObliviousHarmony merged commit fd624f7 into trunk May 10, 2021
@ObliviousHarmony ObliviousHarmony deleted the fix/issue-28284 branch May 10, 2021 18:38
@woocommercebot woocommercebot added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels May 10, 2021
@ObliviousHarmony ObliviousHarmony added changelog added and removed release: add changelog Mark all PRs that have not had their changelog entries added. [auto] labels May 14, 2021
@juliaamosova juliaamosova added testing instructions added and removed release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels May 17, 2021
if(org_title != ""){
if(!opts.content){
org_elem.removeAttr(opts.attribute); //remove original Attribute
org_elem.prop(opts.attribute, false); //remove original Attribute
Copy link
Contributor

Choose a reason for hiding this comment

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

@roykho I think this is breaking some extensions using jquery-tiptip (see 693-gh-woocommerce/woocommerce-product-addonsr example).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check JS libraries included in WooCommerce core to ensure they are compatible with jQuery 3

9 participants