File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -161,8 +161,8 @@ export class FormValidator {
161161
162162 this . formErrors = [ ] ;
163163
164- if ( form [ 'nette-submittedBy' ] && form [ 'nette-submittedBy' ] . getAttribute ( 'formnovalidate' ) !== null ) {
165- let scopeArr = JSON . parse ( form [ 'nette-submittedBy' ] . getAttribute ( 'data-nette-validation-scope' ) ?? '[]' ) as string [ ] ;
164+ if ( sender . getAttribute ( 'formnovalidate' ) !== null ) {
165+ let scopeArr = JSON . parse ( sender . getAttribute ( 'data-nette-validation-scope' ) ?? '[]' ) as string [ ] ;
166166 if ( scopeArr . length ) {
167167 scope = new RegExp ( '^(' + scopeArr . join ( '-|' ) + '-)' ) ;
168168 } else {
@@ -437,7 +437,7 @@ export class FormValidator {
437437 form . noValidate = true ;
438438
439439 form . addEventListener ( 'submit' , ( e ) => {
440- if ( ! this . validateForm ( form ) ) {
440+ if ( ! this . validateForm ( form . submitter || form ) ) {
441441 e . stopPropagation ( ) ;
442442 e . preventDefault ( ) ;
443443 }
@@ -453,17 +453,6 @@ export class FormValidator {
453453 this . #onDocumentReady( ( ) => {
454454 Array . from ( document . forms )
455455 . forEach ( ( form ) => this . initForm ( form ) ) ;
456-
457- document . body . addEventListener ( 'click' , ( e ) => {
458- let target = e . target as FormElement ;
459- while ( target ) {
460- if ( target . form && target . type in { submit : 1 , image : 1 } ) {
461- target . form [ 'nette-submittedBy' ] = target ;
462- break ;
463- }
464- target = target . parentNode as FormElement ;
465- }
466- } ) ;
467456 } ) ;
468457 }
469458}
You can’t perform that action at this time.
0 commit comments