File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -804,12 +804,13 @@ export class ValidationService {
804
804
// Because the submitter is not propagated when calling
805
805
// form.submit(), we recreate it here.
806
806
const submitter = submitEvent . submitter ;
807
+ let submitterInput : HTMLInputElement | null = null ;
807
808
const initialFormAction = form . action ;
808
809
if ( submitter ) {
809
810
const name = submitter . getAttribute ( 'name' ) ;
810
811
// If name is null, a submit button is not submitted.
811
812
if ( name ) {
812
- const submitterInput = document . createElement ( 'input' ) ;
813
+ submitterInput = document . createElement ( 'input' ) ;
813
814
submitterInput . type = 'hidden' ;
814
815
submitterInput . name = name ;
815
816
submitterInput . value = submitter . getAttribute ( 'value' ) ;
@@ -825,6 +826,10 @@ export class ValidationService {
825
826
try {
826
827
form . submit ( ) ;
827
828
} finally {
829
+ if ( submitterInput ) {
830
+ // Important to clean up the submit input we created.
831
+ form . removeChild ( submitterInput ) ;
832
+ }
828
833
form . action = initialFormAction ;
829
834
}
830
835
}
You can’t perform that action at this time.
0 commit comments