Prevent blocking the same element multiple times

Fixes #11242
This commit is contained in:
Mike Jolley 2016-06-24 12:18:31 +01:00
parent 90f1dc8a94
commit 15400fc5f5
2 changed files with 12 additions and 10 deletions

View File

@ -28,7 +28,7 @@ jQuery( function( $ ) {
* @return {bool} True if the DOM Element is UI Blocked, false if not.
*/
var is_blocked = function( $node ) {
return $node.is( '.processing' );
return $node.is( '.processing' ) || $node.parents( '.processing' ).length;
};
/**
@ -37,13 +37,15 @@ jQuery( function( $ ) {
* @param {JQuery Object} $node
*/
var block = function( $node ) {
$node.addClass( 'processing' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
if ( ! is_blocked( $node ) ) {
$node.addClass( 'processing' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
}
};
/**
@ -209,8 +211,8 @@ jQuery( function( $ ) {
var $form = $( evt.currentTarget );
block( $form );
block( $( 'div.cart_totals' ) );
block( $form );
// Provide the submit button value because wc-form-handler expects it.
$( '<input />' ).attr( 'type', 'hidden' )

File diff suppressed because one or more lines are too long