Core: Properly handle nested cancel submit button

Fixes #1370
Closes #1423
Closes #1490
This commit is contained in:
Jörn Zaefferer
2015-06-30 15:07:48 +02:00
parent db877ebd27
commit 328efc91a9

View File

@@ -28,13 +28,14 @@ $.extend($.fn, {
if ( validator.settings.submitHandler ) {
validator.submitButton = event.target;
}
// allow suppressing validation by adding a cancel class to the submit button
if ( $( event.target ).hasClass( "cancel" ) ) {
if ( $( this ).hasClass( "cancel" ) ) {
validator.cancelSubmit = true;
}
// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
if ( $( event.target ).attr( "formnovalidate" ) !== undefined ) {
if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
validator.cancelSubmit = true;
}
});