@@ -527,14 +527,11 @@ class Form {
527
527
/**
528
528
* Executes a function on input elements. Can be limited to certain element types
529
529
* @param {(input: HTMLInputElement|HTMLSelectElement) => void } fn
530
- * @param {'all' | SupportedMainTypes | SupportedMainTypes[] } inputType
530
+ * @param {'all' | SupportedMainTypes } inputType
531
531
* @param {boolean } shouldCheckForDecorate
532
532
*/
533
533
execOnInputs ( fn , inputType = 'all' , shouldCheckForDecorate = true ) {
534
- // FIXME: This is a hack to support multiple input types, but I think we can work with just an array
535
- // Doing this as a quick hack to avoid changing all calling signatures at once.
536
- const inputTypes = Array . isArray ( inputType ) ? inputType : [ inputType ] ;
537
- const inputs = inputTypes . flatMap ( ( inputType ) => [ ...this . inputs [ inputType ] ] ) ;
534
+ const inputs = [ ...this . inputs [ inputType ] ] ;
538
535
for ( const input of inputs ) {
539
536
let canExecute = true ;
540
537
// sometimes we want to execute even if we didn't decorate
@@ -982,14 +979,15 @@ class Form {
982
979
const elVCenter = y + height / 2 ;
983
980
// This checks that the form is not covered by anything else
984
981
const topMostElementFromPoint = document . elementFromPoint ( elHCenter , elVCenter ) ;
982
+ const dataTypeToExec = this . isCCForm ? 'creditCards' : this . isLogin ? 'credentials' : null ;
985
983
if ( this . form . contains ( topMostElementFromPoint ) ) {
986
- this . execOnInputs (
984
+ dataTypeToExec && this . execOnInputs (
987
985
( input ) => {
988
986
if ( isPotentiallyViewable ( input ) ) {
989
987
this . touched . add ( input ) ;
990
988
}
991
989
} ,
992
- [ 'credentials' , 'creditCards' ] ,
990
+ dataTypeToExec ,
993
991
) ;
994
992
this . device . attachTooltip ( {
995
993
form : this ,
0 commit comments