replace jQuery..bind except in 3rd party assets

This commit is contained in:
Kathy Daring 2021-01-07 15:04:26 -07:00
parent a67def78de
commit 61c4e20863
16 changed files with 43 additions and 43 deletions

View File

@ -346,7 +346,7 @@ jQuery( function( $ ) {
postForm.on( 'submit', this.save_on_submit );
$( 'input:submit', postForm ).bind( 'click keypress', function() {
$( 'input:submit', postForm ).on( 'click keypress', function() {
postForm.data( 'callerid', this.id );
});

View File

@ -20,7 +20,7 @@ jQuery( function( $ ) {
});
// Prevent enter submitting post form.
$( '#upsell_product_data' ).bind( 'keypress', function( e ) {
$( '#upsell_product_data' ).on( 'keypress', function( e ) {
if ( e.keyCode === 13 ) {
return false;
}

View File

@ -10,7 +10,7 @@ jQuery(function( $ ) {
var prev_data_index = null;
var prev_series_index = null;
$( '.chart-placeholder' ).bind( 'plothover', function ( event, pos, item ) {
$( '.chart-placeholder' ).on( 'plothover', function ( event, pos, item ) {
if ( item ) {
if ( prev_data_index !== item.dataIndex || prev_series_index !== item.seriesIndex ) {
prev_data_index = item.dataIndex;

View File

@ -11,7 +11,7 @@
this.$form.find('.woocommerce-exporter-progress').val( 0 );
// Methods.
this.processStep = this.processStep.bind( this );
this.processStep = this.processStep.on( this );
// Events.
$form.on( 'submit', { productExportForm: this }, this.onSubmit );

View File

@ -23,7 +23,7 @@
// Initial state.
this.$form.find('.woocommerce-importer-progress').val( 0 );
this.run_import = this.run_import.bind( this );
this.run_import = this.run_import.on( this );
// Start importing.
this.run_import();

View File

@ -252,7 +252,7 @@ jQuery( function( $ ) {
bySlug[ slug ].find( 'a' )
.on( 'mouseenter mouseleave', ( function( $hover, event ) {
$hover.toggleClass( 'plugin-install-source', 'mouseenter' === event.type );
} ).bind( null, hover ? $el.closest( hover ) : $el ) );
} ).on( null, hover ? $el.closest( hover ) : $el ) );
}
}

View File

@ -250,7 +250,7 @@
var shifted = false;
var hasFocus = false;
$( document.body ).bind( 'keyup keydown', function( e ) {
$( document.body ).on( 'keyup keydown', function( e ) {
shifted = e.shiftKey;
controlled = e.ctrlKey || e.metaKey;
});

View File

@ -22,10 +22,10 @@
self.$form.off( '.wc-variation-form' );
// Methods.
self.getChosenAttributes = self.getChosenAttributes.bind( self );
self.findMatchingVariations = self.findMatchingVariations.bind( self );
self.isMatch = self.isMatch.bind( self );
self.toggleResetLink = self.toggleResetLink.bind( self );
self.getChosenAttributes = self.getChosenAttributes.on( self );
self.findMatchingVariations = self.findMatchingVariations.on( self );
self.isMatch = self.isMatch.on( self );
self.toggleResetLink = self.toggleResetLink.on( self );
// Events.
$form.on( 'click.wc-variation-form', '.reset_variations', { variationForm: self }, self.onReset );

View File

@ -10,8 +10,8 @@ jQuery( function( $ ) {
*/
var AddToCartHandler = function() {
this.requests = [];
this.addRequest = this.addRequest.bind( this );
this.run = this.run.bind( this );
this.addRequest = this.addRequest.on( this );
this.run = this.run.on( this );
$( document.body )
.on( 'click', '.add_to_cart_button', { addToCartHandler: this }, this.onAddToCart )

View File

@ -32,7 +32,7 @@ jQuery( function( $ ) {
// Handle locale
$( document.body )
.bind( 'country_to_state_changing', function( event, country, wrapper ) {
.on( 'country_to_state_changing', function( event, country, wrapper ) {
var thisform = wrapper, thislocale;
if ( typeof locale[ country ] !== 'undefined' ) {

View File

@ -180,7 +180,7 @@ jQuery( function( $ ) {
wp.customize.widgetsPreview.WidgetPartial
);
if ( hasSelectiveRefresh ) {
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
wp.customize.selectiveRefresh.on( 'partial-content-rendered', function() {
refresh_cart_fragment();
} );
}

View File

@ -152,9 +152,9 @@ jQuery( function( $ ) {
*/
init: function( cart ) {
this.cart = cart;
this.toggle_shipping = this.toggle_shipping.bind( this );
this.shipping_method_selected = this.shipping_method_selected.bind( this );
this.shipping_calculator_submit = this.shipping_calculator_submit.bind( this );
this.toggle_shipping = this.toggle_shipping.on( this );
this.shipping_method_selected = this.shipping_method_selected.on( this );
this.shipping_calculator_submit = this.shipping_calculator_submit.on( this );
$( document ).on(
'click',
@ -261,16 +261,16 @@ jQuery( function( $ ) {
* Initialize cart UI events.
*/
init: function() {
this.update_cart_totals = this.update_cart_totals.bind( this );
this.input_keypress = this.input_keypress.bind( this );
this.cart_submit = this.cart_submit.bind( this );
this.submit_click = this.submit_click.bind( this );
this.apply_coupon = this.apply_coupon.bind( this );
this.remove_coupon_clicked = this.remove_coupon_clicked.bind( this );
this.quantity_update = this.quantity_update.bind( this );
this.item_remove_clicked = this.item_remove_clicked.bind( this );
this.item_restore_clicked = this.item_restore_clicked.bind( this );
this.update_cart = this.update_cart.bind( this );
this.update_cart_totals = this.update_cart_totals.on( this );
this.input_keypress = this.input_keypress.on( this );
this.cart_submit = this.cart_submit.on( this );
this.submit_click = this.submit_click.on( this );
this.apply_coupon = this.apply_coupon.on( this );
this.remove_coupon_clicked = this.remove_coupon_clicked.on( this );
this.quantity_update = this.quantity_update.on( this );
this.item_remove_clicked = this.item_remove_clicked.on( this );
this.item_restore_clicked = this.item_restore_clicked.on( this );
this.update_cart = this.update_cart.on( this );
$( document ).on(
'wc_update_cart added_to_cart',

View File

@ -16,8 +16,8 @@ jQuery( function( $ ) {
$order_review: $( '#order_review' ),
$checkout_form: $( 'form.checkout' ),
init: function() {
$( document.body ).bind( 'update_checkout', this.update_checkout );
$( document.body ).bind( 'init_checkout', this.init_checkout );
$( document.body ).on( 'update_checkout', this.update_checkout );
$( document.body ).on( 'init_checkout', this.init_checkout );
// Payment methods
this.$checkout_form.on( 'click', 'input[name="payment_method"]', this.payment_method_selected );

View File

@ -70,7 +70,7 @@ jQuery( function( $ ) {
wc_country_select_select2();
$( document.body ).bind( 'country_to_state_changed', function() {
$( document.body ).on( 'country_to_state_changed', function() {
wc_country_select_select2();
});
}

View File

@ -118,13 +118,13 @@ jQuery( function( $ ) {
}
// Bind functions to this.
this.initFlexslider = this.initFlexslider.bind( this );
this.initZoom = this.initZoom.bind( this );
this.initZoomForTarget = this.initZoomForTarget.bind( this );
this.initPhotoswipe = this.initPhotoswipe.bind( this );
this.onResetSlidePosition = this.onResetSlidePosition.bind( this );
this.getGalleryItems = this.getGalleryItems.bind( this );
this.openPhotoswipe = this.openPhotoswipe.bind( this );
this.initFlexslider = this.initFlexslider.on( this );
this.initZoom = this.initZoom.on( this );
this.initZoomForTarget = this.initZoomForTarget.on( this );
this.initPhotoswipe = this.initPhotoswipe.on( this );
this.onResetSlidePosition = this.onResetSlidePosition.on( this );
this.getGalleryItems = this.getGalleryItems.on( this );
this.openPhotoswipe = this.openPhotoswipe.on( this );
if ( this.flexslider_enabled ) {
this.initFlexslider( args.flexslider );

View File

@ -15,11 +15,11 @@ jQuery( function( $ ) {
}, wc_tokenization_form_params );
// Bind functions to this.
this.onDisplay = this.onDisplay.bind( this );
this.hideForm = this.hideForm.bind( this );
this.showForm = this.showForm.bind( this );
this.showSaveNewCheckbox = this.showSaveNewCheckbox.bind( this );
this.hideSaveNewCheckbox = this.hideSaveNewCheckbox.bind( this );
this.onDisplay = this.onDisplay.on( this );
this.hideForm = this.hideForm.on( this );
this.showForm = this.showForm.on( this );
this.showSaveNewCheckbox = this.showSaveNewCheckbox.on( this );
this.hideSaveNewCheckbox = this.hideSaveNewCheckbox.on( this );
// When a radio button is changed, make sure to show/hide our new CC info area.
this.$target.on(