Cart.js: Only prevent submit for specific buttons

Fixes #11148

Only prevent default submit actions for our own
"Update Cart" and "Add Coupon" operations.
This commit is contained in:
Kevin Killingsworth 2016-06-15 14:13:46 -05:00
parent 265a4faa10
commit 230ba6e5bf
2 changed files with 3 additions and 3 deletions

View File

@ -335,8 +335,6 @@ jQuery( function( $ ) {
* @param {Object} evt The JQuery event
*/
cart_submit: function( evt ) {
evt.preventDefault();
var $form = $( evt.currentTarget );
var $submit = $( document.activeElement );
var $clicked = $( 'input[type=submit][clicked=true]' );
@ -349,9 +347,11 @@ jQuery( function( $ ) {
}
if ( $clicked.is( '[name="update_cart"]' ) || $submit.is( 'input.qty' ) ) {
evt.preventDefault();
this.quantity_update( $form );
} else if ( $clicked.is( '[name="apply_coupon"]' ) || $submit.is( '#coupon_code' ) ) {
evt.preventDefault();
this.apply_coupon( $form );
}
},

File diff suppressed because one or more lines are too long