diff --git a/.github/workflows/build-release-zip-file.yml b/.github/workflows/build-release-zip-file.yml new file mode 100644 index 00000000000..2f6dd819e20 --- /dev/null +++ b/.github/workflows/build-release-zip-file.yml @@ -0,0 +1,30 @@ +name: Build release zip file +on: + workflow_dispatch: + inputs: + ref: + description: 'By default the zip file is generated from the branch the workflow runs from, but you can specify an explicit reference to use instead here (e.g. refs/tags/tag_name). The resulting file will be available as an artifact on the workflow run.' + required: false + default: '' +jobs: + build: + name: Build release zip file + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.ref || github.ref }} + - name: Build the zip file + id: build + uses: woocommerce/action-build@v2 + - name: Unzip the file (prevents double zip problem) + run: unzip ${{ steps.build.outputs.zip_path }} -d zipfile + - name: Upload the zip file as an artifact + uses: actions/upload-artifact@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: woocommerce + path: zipfile + retention-days: 7 diff --git a/.github/workflows/pull-request-post-merge-processing.yml b/.github/workflows/pull-request-post-merge-processing.yml new file mode 100644 index 00000000000..1347ed5e5e1 --- /dev/null +++ b/.github/workflows/pull-request-post-merge-processing.yml @@ -0,0 +1,32 @@ +name: "Pull request post-merge processing" +on: + pull_request: + types: [closed] + +jobs: + assign-milestone: + name: "Assign milestone to merged pull request" + if: github.event.pull_request.merged == true && ! github.event.pull_request.milestone + runs-on: ubuntu-latest + steps: + - name: "Get the milestone changer script" + run: | + curl \ + --silent \ + --fail \ + --header 'Authorization: bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'User-Agent: GitHub action to set the milestone for a pull request' \ + --header 'Accept: application/vnd.github.v3.raw' \ + --remote-name \ + --location $GITHUB_API_URL/repos/${{ github.repository }}/contents/.github/workflows/scripts/assign-milestone-to-merged-pr.php + env: + GITHUB_API_URL: ${{ env.GITHUB_API_URL }} + - name: "Install PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + - name: "Run the milestone changer script" + run: php assign-milestone-to-merged-pr.php + env: + PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/scripts/assign-milestone-to-merged-pr.php b/.github/workflows/scripts/assign-milestone-to-merged-pr.php new file mode 100644 index 00000000000..0258813e209 --- /dev/null +++ b/.github/workflows/scripts/assign-milestone-to-merged-pr.php @@ -0,0 +1,144 @@ + "$keyword { $body }" ); + $context = stream_context_create( + array( + 'http' => array( + 'method' => 'POST', + 'header' => array( + 'Accept: application/json', + 'Content-Type: application/json', + 'User-Agent: GitHub action to set the milestone for a pull request', + 'Authorization: bearer ' . $github_token, + ), + 'content' => json_encode( $data ), + ), + ) + ); + + $result = file_get_contents( $graphql_api_url, false, $context ); + return json_decode( $result, true ); +} + +// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.AlternativeFunctions diff --git a/.github/workflows/smoke-test-daily.yml b/.github/workflows/smoke-test-daily.yml new file mode 100644 index 00000000000..e859ad41ed3 --- /dev/null +++ b/.github/workflows/smoke-test-daily.yml @@ -0,0 +1,42 @@ +name: Smoke test daily +on: + schedule: + - cron: '25 3 * * *' +jobs: + login-run: + name: Daily smoke test on trunk. + runs-on: ubuntu-18.04 + steps: + + - name: Create dirs. + run: | + mkdir -p code/woocommerce + mkdir -p package/woocommerce + mkdir -p tmp/woocommerce + mkdir -p node_modules + + - name: Checkout code. + uses: actions/checkout@v2 + with: + ref: trunk + + - name: Install prerequisites. + run: | + npm install + composer install --no-dev + npm run build:assets + npm install jest + + - name: Run smoke test. + env: + SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }} + SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }} + SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }} + SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }} + SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }} + WC_E2E_SCREENSHOTS: 1 + E2E_RETEST: 1 + E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }} + E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }} + run: | + npx wc-e2e test:e2e diff --git a/.github/workflows/stalebot.yml b/.github/workflows/stalebot.yml index 0c91b9a5410..23c1a0eec6e 100644 --- a/.github/workflows/stalebot.yml +++ b/.github/workflows/stalebot.yml @@ -1,7 +1,7 @@ name: 'Close stale needs-feedback issues' on: schedule: - - cron: '0 21 * * *' + - cron: '21 0 * * *' jobs: stale: @@ -15,6 +15,6 @@ jobs: days-before-issue-stale: 7 days-before-issue-close: 7 days-before-pr-close: -1 - only-issue-label: 'needs feedback' + only-issue-labels: 'needs feedback' close-issue-label: "category: can't reproduce" - debug-only: true + ascending: true diff --git a/.github/workflows/update-feedback-labels.yml b/.github/workflows/update-feedback-labels.yml new file mode 100644 index 00000000000..bb0af46f64b --- /dev/null +++ b/.github/workflows/update-feedback-labels.yml @@ -0,0 +1,27 @@ +name: 'Update contributor feedback labels on comment' +on: 'issue_comment' + +jobs: + feedback: + if: | + github.actor != 'github-actions' && + github.event.issue && + github.event.issue.state == 'open' && + contains(github.event.issue.labels.*.name, 'needs feedback') + runs-on: ubuntu-latest + steps: + - name: Add has feedback + uses: actions-ecosystem/action-add-labels@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: 'has feedback' + - name: remove needs feedback + uses: actions-ecosystem/action-remove-labels@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: 'needs feedback' + - name: remove stale + uses: actions-ecosystem/action-remove-labels@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: Stale diff --git a/.gitignore b/.gitignore index d5584c21452..106818c04f8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ project.properties .settings* .idea .vscode +.eslintcache *.sublime-project *.sublime-workspace .sublimelinterrc diff --git a/assets/css/admin.scss b/assets/css/admin.scss index 3dca45bdf8c..6ea357b8e2a 100644 --- a/assets/css/admin.scss +++ b/assets/css/admin.scss @@ -161,6 +161,43 @@ } } + .addons-promotion-block { + display: flex; + padding: 20px; + + .addons-img { + height: auto; + width: 200px; + } + } + + .addons-promotion-block-content { + display: flex; + flex-direction: column; + margin-left: 24px; + } + + .addons-promotion-block-description { + margin-bottom: 20px; + } + + .addons-promotion-block-title { + margin: 0 0 16px; + padding: 0; + } + + .addons-promotion-block-buttons { + margin-top: auto; + + .addons-button { + margin-right: 8px; + + &:last-child { + margin-right: 0; + } + } + } + .addons-shipping-methods .addons-wcs-banner-block { margin-left: 0; margin-right: 0; @@ -364,6 +401,12 @@ color: #fff; } + .addons-button-expandable { + display: inline-block; + padding: 0 16px; + width: auto; + } + .addons-button-solid:hover { color: #fff; opacity: 0.8; @@ -2642,6 +2685,30 @@ ul.wc_coupon_list_block { float: right; } } + + .wc_addons_wrap { + + .addons-promotion-block { + flex-direction: column; + padding: 24px; + + .addons-img { + height: auto; + width: 100%; + max-width: 240px; + margin: 0 auto 20px; + } + } + + .addons-promotion-block-content { + display: block; + margin-left: 0; + } + + .addons-promotion-block-title { + margin-top: 4px; + } + } } .column-customer_message .note-on { diff --git a/assets/js/admin/api-keys.js b/assets/js/admin/api-keys.js index f51a2cf7e0d..5c22ef3640e 100644 --- a/assets/js/admin/api-keys.js +++ b/assets/js/admin/api-keys.js @@ -53,7 +53,7 @@ .on( 'click', css_class, function( evt ) { evt.preventDefault(); if ( ! document.queryCommandSupported( 'copy' ) ) { - $( css_class ).parent().find( 'input' ).focus().select(); + $( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' ); $( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed ); } else { $( '#copy-error' ).text( '' ); @@ -69,10 +69,10 @@ 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - } ).focus(); + } ).trigger( 'focus' ); } ) .on( 'aftercopyerror', css_class, function() { - $( css_class ).parent().find( 'input' ).focus().select(); + $( css_class ).parent().find( 'input' ).trigger( 'focus' ).trigger( 'select' ); $( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed ); } ); }, diff --git a/assets/js/admin/backbone-modal.js b/assets/js/admin/backbone-modal.js index 63cca56422a..061a37c8bae 100644 --- a/assets/js/admin/backbone-modal.js +++ b/assets/js/admin/backbone-modal.js @@ -72,7 +72,7 @@ _.bindAll( this, 'render' ); this.render(); - $( window ).resize(function() { + $( window ).on( 'resize', function() { view.resizeContent(); }); }, @@ -88,7 +88,7 @@ }).append( this.$el ); this.resizeContent(); - this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).focus(); + this.$( '.wc-backbone-modal-content' ).attr( 'tabindex' , '0' ).trigger( 'focus' ); $( document.body ).trigger( 'init_tooltips' ); diff --git a/assets/js/admin/meta-boxes-coupon.js b/assets/js/admin/meta-boxes-coupon.js index c4327f33644..594726739c0 100644 --- a/assets/js/admin/meta-boxes-coupon.js +++ b/assets/js/admin/meta-boxes-coupon.js @@ -61,7 +61,7 @@ jQuery(function( $ ) { ); } $result = woocommerce_admin_meta_boxes_coupon.prefix + $result + woocommerce_admin_meta_boxes_coupon.suffix; - $coupon_code_field.focus().val( $result ); + $coupon_code_field.trigger( 'focus' ).val( $result ); $coupon_code_label.addClass( 'screen-reader-text' ); } }; diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index 2267afe26ed..f108dff0ec6 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -22,7 +22,7 @@ jQuery( function ( $ ) { this.states = JSON.parse( woocommerce_admin_meta_boxes_order.countries.replace( /"/g, '"' ) ); } - $( '.js_field-country' ).selectWoo().change( this.change_country ); + $( '.js_field-country' ).selectWoo().on( 'change', this.change_country ); $( '.js_field-country' ).trigger( 'change', [ true ] ); $( document.body ).on( 'change', 'select.js_field-state', this.change_state ); $( '#woocommerce-order-actions input, #woocommerce-order-actions a' ).on( 'click', function() { @@ -140,7 +140,7 @@ jQuery( function ( $ ) { is_billing = Boolean( $edit_address.find( 'input[name^="_billing_"]' ).length ); $address.hide(); - $this.parent().find( 'a' ).toggle(); + $this.parent().find( 'a' ).trigger( 'toggle' ); if ( ! $country_input.val() ) { $country_input.val( woocommerce_admin_meta_boxes_order.default_country ).trigger( 'change' ); @@ -1470,7 +1470,7 @@ jQuery( function ( $ ) { 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - }).focus(); + }).trigger( 'focus' ); }, /** @@ -1483,7 +1483,7 @@ jQuery( function ( $ ) { 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - }).focus(); + }).trigger( 'focus' ); } }; diff --git a/assets/js/admin/meta-boxes-product-variation.js b/assets/js/admin/meta-boxes-product-variation.js index 551ad33a114..fbb9701f04d 100644 --- a/assets/js/admin/meta-boxes-product-variation.js +++ b/assets/js/admin/meta-boxes-product-variation.js @@ -594,7 +594,7 @@ jQuery( function( $ ) { $( '.woocommerce-notice-invalid-variation' ).remove(); $( '#variable_product_options' ).find( '.woocommerce_variations' ).prepend( variation ); - $( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); + $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_added', 1 ); wc_meta_boxes_product_variations_ajax.unblock(); }); @@ -700,7 +700,7 @@ jQuery( function( $ ) { .closest( '.woocommerce_variation' ) .addClass( 'variation-needs-update' ); - $( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); + $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_input_changed' ); }, @@ -714,7 +714,7 @@ jQuery( function( $ ) { .find( '.woocommerce_variation:first' ) .addClass( 'variation-needs-update' ); - $( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' ); + $( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false ); $( '#variable_product_options' ).trigger( 'woocommerce_variations_defaults_changed' ); }, diff --git a/assets/js/admin/meta-boxes-product.js b/assets/js/admin/meta-boxes-product.js index 6d00cbc7a7b..e9cad28e4c6 100644 --- a/assets/js/admin/meta-boxes-product.js +++ b/assets/js/admin/meta-boxes-product.js @@ -34,17 +34,23 @@ jQuery( function( $ ) { } $( function() { - // Prevent inputs in meta box headings opening/closing contents. - $( '#woocommerce-product-data' ).find( '.hndle' ).unbind( 'click.postboxes' ); + var woocommerce_product_data = $( '#woocommerce-product-data' ); - $( '#woocommerce-product-data' ).on( 'click', '.hndle', function( event ) { + // Prevent inputs in meta box headings opening/closing contents. + woocommerce_product_data.find( '.hndle' ).off( 'click.postboxes' ); + + woocommerce_product_data.on( 'click', '.hndle', function( event ) { // If the user clicks on some form input inside the h3 the box should not be toggled. if ( $( event.target ).filter( 'input, option, label, select' ).length ) { return; } - $( '#woocommerce-product-data' ).toggleClass( 'closed' ); + if ( woocommerce_product_data.hasClass( 'closed' ) ) { + woocommerce_product_data.removeClass( 'closed' ); + } else { + woocommerce_product_data.addClass( 'closed' ); + } }); }); @@ -77,7 +83,7 @@ jQuery( function( $ ) { var current_visibility = $( '#current_visibility' ).val(); var current_featured = $( '#current_featured' ).val(); - $( 'input[name=_visibility]' ).removeAttr( 'checked' ); + $( 'input[name=_visibility]' ).prop( 'checked', false ); $( 'input[name=_visibility][value=' + current_visibility + ']' ).attr( 'checked', 'checked' ); var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' ); @@ -86,7 +92,7 @@ jQuery( function( $ ) { label = label + ', ' + woocommerce_admin_meta_boxes.featured_label; $( 'input[name=_featured]' ).attr( 'checked', 'checked' ); } else { - $( 'input[name=_featured]' ).removeAttr( 'checked' ); + $( 'input[name=_featured]' ).prop( 'checked', false ); } $( '#catalog-visibility-display' ).text( label ); @@ -94,7 +100,7 @@ jQuery( function( $ ) { }); // Product type specific options. - $( 'select#product-type' ).change( function() { + $( 'select#product-type' ).on( 'change', function() { // Get value. var select_val = $( this ).val(); @@ -102,13 +108,13 @@ jQuery( function( $ ) { if ( 'variable' === select_val ) { $( 'input#_manage_stock' ).trigger( 'change' ); $( 'input#_downloadable' ).prop( 'checked', false ); - $( 'input#_virtual' ).removeAttr( 'checked' ); + $( 'input#_virtual' ).prop( 'checked', false ); } else if ( 'grouped' === select_val ) { $( 'input#_downloadable' ).prop( 'checked', false ); - $( 'input#_virtual' ).removeAttr( 'checked' ); + $( 'input#_virtual' ).prop( 'checked', false ); } else if ( 'external' === select_val ) { $( 'input#_downloadable' ).prop( 'checked', false ); - $( 'input#_virtual' ).removeAttr( 'checked' ); + $( 'input#_virtual' ).prop( 'checked', false ); } show_and_hide_panels(); @@ -119,7 +125,7 @@ jQuery( function( $ ) { }).trigger( 'change' ); - $( 'input#_downloadable, input#_virtual' ).change( function() { + $( 'input#_downloadable, input#_virtual' ).on( 'change', function() { show_and_hide_panels(); }); @@ -239,7 +245,7 @@ jQuery( function( $ ) { }); // Stock options. - $( 'input#_manage_stock' ).change( function() { + $( 'input#_manage_stock' ).on( 'change', function() { if ( $( this ).is( ':checked' ) ) { $( 'div.stock_fields' ).show(); $( 'p.stock_status_field' ).hide(); @@ -361,7 +367,7 @@ jQuery( function( $ ) { }); $( '.product_attributes' ).on( 'click', 'button.select_no_attributes', function() { - $( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' ); + $( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false ); $( this ).closest( 'td' ).find( 'select' ).trigger( 'change' ); return false; }); @@ -373,7 +379,7 @@ jQuery( function( $ ) { if ( $parent.is( '.taxonomy' ) ) { $parent.find( 'select, input[type=text]' ).val( '' ); $parent.hide(); - $( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).removeAttr( 'disabled' ); + $( 'select.attribute_taxonomy' ).find( 'option[value="' + $parent.data( 'taxonomy' ) + '"]' ).prop( 'disabled', false ); } else { $parent.find( 'select, input[type=text]' ).val( '' ); $parent.hide(); diff --git a/assets/js/admin/meta-boxes.js b/assets/js/admin/meta-boxes.js index 1f82968994f..a815b38315c 100644 --- a/assets/js/admin/meta-boxes.js +++ b/assets/js/admin/meta-boxes.js @@ -17,7 +17,19 @@ jQuery( function ( $ ) { runTipTip(); $( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() { - $( this ).parent( '.wc-metabox' ).toggleClass( 'closed' ).toggleClass( 'open' ); + var metabox = $( this ).parent( '.wc-metabox' ); + + if ( metabox.hasClass( 'closed' ) ) { + metabox.removeClass( 'closed' ); + } else { + metabox.addClass( 'closed' ); + } + + if ( metabox.hasClass( 'open' ) ) { + metabox.removeClass( 'open' ); + } else { + metabox.addClass( 'open' ); + } }); // Tabbed Panels diff --git a/assets/js/admin/quick-edit.js b/assets/js/admin/quick-edit.js index 8c64a049f33..c15b76f580d 100644 --- a/assets/js/admin/quick-edit.js +++ b/assets/js/admin/quick-edit.js @@ -57,7 +57,7 @@ jQuery( 'select[name="_visibility"] option, ' + 'select[name="_stock_status"] option, ' + 'select[name="_backorders"] option' - ).removeAttr( 'selected' ); + ).prop( 'selected', false ); var is_variable_product = 'variable' === product_type; $( 'select[name="_stock_status"] ~ .wc-quick-edit-warning', '.inline-edit-row' ).toggle( is_variable_product ); @@ -72,7 +72,7 @@ jQuery( if ( 'yes' === featured ) { $( 'input[name="_featured"]', '.inline-edit-row' ).attr( 'checked', 'checked' ); } else { - $( 'input[name="_featured"]', '.inline-edit-row' ).removeAttr( 'checked' ); + $( 'input[name="_featured"]', '.inline-edit-row' ).prop( 'checked', false ); } // Conditional display. diff --git a/assets/js/admin/settings-views-html-settings-tax.js b/assets/js/admin/settings-views-html-settings-tax.js index 061c2bd1af7..f7c79fe01c1 100644 --- a/assets/js/admin/settings-views-html-settings-tax.js +++ b/assets/js/admin/settings-views-html-settings-tax.js @@ -167,7 +167,7 @@ // Postcode and city don't have `name` values by default. // They're only created if the contents changes, to save on database queries (I think) - this.$el.find( 'td.postcode input, td.city input' ).change( function() { + this.$el.find( 'td.postcode input, td.city input' ).on( 'change', function() { $( this ).attr( 'name', $( this ).data( 'name' ) ); }); diff --git a/assets/js/admin/settings.js b/assets/js/admin/settings.js index de5931fd25d..72306309d24 100644 --- a/assets/js/admin/settings.js +++ b/assets/js/admin/settings.js @@ -2,7 +2,7 @@ ( function( $, params, wp ) { $( function() { // Sell Countries - $( 'select#woocommerce_allowed_countries' ).change( function() { + $( 'select#woocommerce_allowed_countries' ).on( 'change', function() { if ( 'specific' === $( this ).val() ) { $( this ).closest('tr').next( 'tr' ).hide(); $( this ).closest('tr').next().next( 'tr' ).show(); @@ -16,7 +16,7 @@ }).trigger( 'change' ); // Ship Countries - $( 'select#woocommerce_ship_to_countries' ).change( function() { + $( 'select#woocommerce_ship_to_countries' ).on( 'change', function() { if ( 'specific' === $( this ).val() ) { $( this ).closest('tr').next( 'tr' ).show(); } else { @@ -25,7 +25,7 @@ }).trigger( 'change' ); // Stock management - $( 'input#woocommerce_manage_stock' ).change( function() { + $( 'input#woocommerce_manage_stock' ).on( 'change', function() { if ( $( this ).is(':checked') ) { $( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).show(); } else { @@ -48,15 +48,15 @@ event.stopPropagation(); $( '.iris-picker' ).hide(); $( this ).closest( 'td' ).find( '.iris-picker' ).show(); - $( this ).data( 'original-value', $( this ).val() ); + $( this ).data( 'originalValue', $( this ).val() ); }) .on( 'change', function() { if ( $( this ).is( '.iris-error' ) ) { - var original_value = $( this ).data( 'original-value' ); + var original_value = $( this ).data( 'originalValue' ); if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) { - $( this ).val( $( this ).data( 'original-value' ) ).trigger( 'change' ); + $( this ).val( $( this ).data( 'originalValue' ) ).trigger( 'change' ); } else { $( this ).val( '' ).trigger( 'change' ); } @@ -71,7 +71,7 @@ $( function() { var changed = false; - $( 'input, textarea, select, checkbox' ).change( function() { + $( 'input, textarea, select, checkbox' ).on( 'change', function() { if ( ! changed ) { window.onbeforeunload = function() { return params.i18n_nav_warning; @@ -116,7 +116,7 @@ }); $( '.woocommerce' ).on( 'click', '.select_none', function() { - $( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' ); + $( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', false ); $( this ).closest( 'td' ).find( 'select' ).trigger( 'change' ); return false; }); @@ -126,7 +126,7 @@ var moveBtn = $( this ), $row = moveBtn.closest( 'tr' ); - moveBtn.focus(); + moveBtn.trigger( 'focus' ); var isMoveUp = moveBtn.is( '.wc-move-up' ), isMoveDown = moveBtn.is( '.wc-move-down' ); @@ -147,7 +147,7 @@ } } - moveBtn.focus(); // Re-focus after the container was moved. + moveBtn.trigger( 'focus' ); // Re-focus after the container was moved. moveBtn.closest( 'table' ).trigger( 'updateMoveButtons' ); } ); diff --git a/assets/js/admin/system-status.js b/assets/js/admin/system-status.js index cb84c875444..a2457530a5a 100644 --- a/assets/js/admin/system-status.js +++ b/assets/js/admin/system-status.js @@ -33,11 +33,11 @@ jQuery( function ( $ ) { $( '.wc_status_table thead, .wc_status_table tbody' ).each( function() { if ( $( this ).is( 'thead' ) ) { - var label = $( this ).find( 'th:eq(0)' ).data( 'export-label' ) || $( this ).text(); + var label = $( this ).find( 'th:eq(0)' ).data( 'exportLabel' ) || $( this ).text(); report = report + '\n### ' + label.trim() + ' ###\n\n'; } else { $( 'tr', $( this ) ).each( function() { - var label = $( this ).find( 'td:eq(0)' ).data( 'export-label' ) || $( this ).find( 'td:eq(0)' ).text(); + var label = $( this ).find( 'td:eq(0)' ).data( 'exportLabel' ) || $( this ).find( 'td:eq(0)' ).text(); var the_name = label.trim().replace( /(<([^>]+)>)/ig, '' ); // Remove HTML. // Find value @@ -68,7 +68,7 @@ jQuery( function ( $ ) { try { $( '#debug-report' ).slideDown(); - $( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).focus().select(); + $( '#debug-report' ).find( 'textarea' ).val( '`' + report + '`' ).trigger( 'focus' ).trigger( 'select' ); $( this ).fadeOut(); return false; } catch ( e ) { @@ -100,7 +100,7 @@ jQuery( function ( $ ) { 'fadeIn': 50, 'fadeOut': 50, 'delay': 0 - }).focus(); + }).trigger( 'focus' ); }, /** @@ -108,7 +108,7 @@ jQuery( function ( $ ) { */ copyFail: function() { $( '.copy-error' ).removeClass( 'hidden' ); - $( '#debug-report' ).find( 'textarea' ).focus().select(); + $( '#debug-report' ).find( 'textarea' ).trigger( 'focus' ).trigger( 'select' ); } }; diff --git a/assets/js/admin/users.js b/assets/js/admin/users.js index cb2b816604e..2d6c1fa7138 100644 --- a/assets/js/admin/users.js +++ b/assets/js/admin/users.js @@ -12,7 +12,7 @@ jQuery( function ( $ ) { this.states = JSON.parse( wc_users_params.countries.replace( /"/g, '"' ) ); } - $( '.js_field-country' ).selectWoo().change( this.change_country ); + $( '.js_field-country' ).selectWoo().on( 'change', this.change_country ); $( '.js_field-country' ).trigger( 'change', [ true ] ); $( document.body ).on( 'change', 'select.js_field-state', this.change_state ); diff --git a/assets/js/admin/wc-clipboard.js b/assets/js/admin/wc-clipboard.js index fc009d02041..8a2391213ae 100644 --- a/assets/js/admin/wc-clipboard.js +++ b/assets/js/admin/wc-clipboard.js @@ -17,7 +17,7 @@ function wcSetClipboard( data, $el ) { } var $temp_input = jQuery( '