From 489d8042d0d09cbed1f1a5caa911010d995355d8 Mon Sep 17 00:00:00 2001 From: Kathy Daring Date: Thu, 7 Jan 2021 15:15:15 -0700 Subject: [PATCH] Replace jQuery.trim() except in 3rd party assets --- assets/js/admin/api-keys.js | 2 +- assets/js/admin/system-status.js | 6 +++--- assets/js/frontend/add-to-cart-variation.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/js/admin/api-keys.js b/assets/js/admin/api-keys.js index 6ac852ff214..5c22ef3640e 100644 --- a/assets/js/admin/api-keys.js +++ b/assets/js/admin/api-keys.js @@ -58,7 +58,7 @@ } else { $( '#copy-error' ).text( '' ); wcClearClipboard(); - wcSetClipboard( $.trim( $( this ).prev( 'input' ).val() ), $( css_class ) ); + wcSetClipboard( $( this ).prev( 'input' ).val().trim(), $( css_class ) ); } } ) .on( 'aftercopy', css_class, function() { diff --git a/assets/js/admin/system-status.js b/assets/js/admin/system-status.js index 317625898c1..6cdb54d14cf 100644 --- a/assets/js/admin/system-status.js +++ b/assets/js/admin/system-status.js @@ -34,11 +34,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(); - report = report + '\n### ' + $.trim( label ) + ' ###\n\n'; + 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 the_name = $.trim( label ).replace( /(<([^>]+)>)/ig, '' ); // Remove HTML. + var the_name = label.trim().replace( /(<([^>]+)>)/ig, '' ); // Remove HTML. // Find value var $value_html = $( this ).find( 'td:eq(2)' ).clone(); @@ -47,7 +47,7 @@ jQuery( function ( $ ) { $value_html.find( '.dashicons-no-alt, .dashicons-warning' ).replaceWith( '❌' ); // Format value - var the_value = $.trim( $value_html.text() ); + var the_value = $value_html.text().trim(); var value_array = the_value.split( ', ' ); if ( value_array.length > 1 ) { diff --git a/assets/js/frontend/add-to-cart-variation.js b/assets/js/frontend/add-to-cart-variation.js index f5912bff89a..71f46d7fd4c 100644 --- a/assets/js/frontend/add-to-cart-variation.js +++ b/assets/js/frontend/add-to-cart-variation.js @@ -314,7 +314,7 @@ } // Reveal - if ( $.trim( form.$singleVariation.text() ) ) { + if ( form.$singleVariation.text().trim() ) { form.$singleVariation.slideDown( 200 ).trigger( 'show_variation', [ variation, purchasable ] ); } else { form.$singleVariation.show().trigger( 'show_variation', [ variation, purchasable ] );