@@ -13,10 +13,6 @@ import {
1313} from 'axobject-query' ;
1414import type { Node } from 'ast-types-flow' ;
1515import flatMap from 'array.prototype.flatmap' ;
16- import iterFrom from 'es-iterator-helpers/Iterator.from' ;
17- // import iterFlatMap from 'es-iterator-helpers/Iterator.prototype.flatMap';
18- import filter from 'es-iterator-helpers/Iterator.prototype.filter' ;
19- import some from 'es-iterator-helpers/Iterator.prototype.some' ;
2016
2117import attributesComparator from './attributesComparator' ;
2218
@@ -61,21 +57,18 @@ const interactiveRoles = new Set(roleKeys
6157 'toolbar' ,
6258 ) ) ;
6359
64- // TODO: convert to use iterFlatMap and iterFrom
6560const interactiveElementRoleSchemas = flatMap (
6661 elementRoleEntries ,
6762 ( [ elementSchema , rolesArr ] ) => ( rolesArr . some ( ( role ) : boolean => interactiveRoles . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
6863) ;
6964
70- // TODO: convert to use iterFlatMap and iterFrom
7165const nonInteractiveElementRoleSchemas = flatMap (
7266 elementRoleEntries ,
7367 ( [ elementSchema , rolesArr ] ) => ( rolesArr . every ( ( role ) : boolean => nonInteractiveRoles . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
7468) ;
7569
76- const nonInteractiveAXObjects = new Set ( filter ( iterFrom ( AXObjects . keys ( ) ) , ( name ) => [ 'window' , 'structure' ] . includes ( AXObjects . get ( name ) . type ) ) ) ;
70+ const nonInteractiveAXObjects = new Set ( AXObjects . keys ( ) . filter ( ( name ) => [ 'window' , 'structure' ] . includes ( AXObjects . get ( name ) . type ) ) ) ;
7771
78- // TODO: convert to use iterFlatMap and iterFrom
7972const nonInteractiveElementAXObjectSchemas = flatMap (
8073 [ ...elementAXObjects ] ,
8174 ( [ elementSchema , AXObjectsArr ] ) => ( AXObjectsArr . every ( ( role ) : boolean => nonInteractiveAXObjects . has ( role ) ) ? [ elementSchema ] : [ ] ) ,
@@ -91,18 +84,18 @@ function checkIsNonInteractiveElement(tagName, attributes): boolean {
9184 }
9285 // Check in elementRoles for inherent non-interactive role associations for
9386 // this element.
94- const isInherentNonInteractiveElement = some ( iterFrom ( nonInteractiveElementRoleSchemas ) , elementSchemaMatcher ) ;
87+ const isInherentNonInteractiveElement = nonInteractiveElementRoleSchemas . some ( elementSchemaMatcher ) ;
9588 if ( isInherentNonInteractiveElement ) {
9689 return true ;
9790 }
9891 // Check in elementRoles for inherent interactive role associations for
9992 // this element.
100- const isInherentInteractiveElement = some ( iterFrom ( interactiveElementRoleSchemas ) , elementSchemaMatcher ) ;
93+ const isInherentInteractiveElement = interactiveElementRoleSchemas . some ( elementSchemaMatcher ) ;
10194 if ( isInherentInteractiveElement ) {
10295 return false ;
10396 }
10497 // Check in elementAXObjects for AX Tree associations for this element.
105- const isNonInteractiveAXElement = some ( iterFrom ( nonInteractiveElementAXObjectSchemas ) , elementSchemaMatcher ) ;
98+ const isNonInteractiveAXElement = nonInteractiveElementAXObjectSchemas . some ( elementSchemaMatcher ) ;
10699 if ( isNonInteractiveAXElement ) {
107100 return true ;
108101 }
0 commit comments