Merge pull request #16087 from woocommerce/fix/race

Remove race condition
This commit is contained in:
Mike Jolley 2017-07-12 09:58:06 +01:00 committed by GitHub
commit 0b3b0058f5
1 changed files with 5 additions and 5 deletions

View File

@ -273,15 +273,15 @@ class WC_Widget_Layered_Nav extends WC_Widget {
echo '</form>';
wc_enqueue_js( "
// Submit form on change if standard dropdown.
jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . ":not([multiple])' ).change( function() {
jQuery( this ).closest( 'form' ).submit();
});
// Update value on change.
jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . "' ).change( function() {
var slug = jQuery( this ).val();
jQuery( ':input[name=\"filter_" . esc_js( $taxonomy_filter_name ) . "\"]' ).val( slug );
// Submit form on change if standard dropdown.
if ( ! jQuery( this ).attr( 'multiple' ) ) {
jQuery( this ).closest( 'form' ).submit();
}
});
// Use Select2 enhancement if possible