File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ async function axeData(params) {
1010 results . device = device ( ) ;
1111 results . browser = getBrowser ( ) ;
1212 results . date = getFormattedDate ( ) ;
13+
14+ flattenTargetArrays ( results . violations ) ;
15+ flattenTargetArrays ( results . incomplete ) ;
16+ flattenTargetArrays ( results . inapplicable ) ;
1317 return results ;
1418}
1519
@@ -100,4 +104,18 @@ function injectAxeScript(scriptURL) {
100104 script . addEventListener ( 'error' , e => reject ( e . error ) ) ;
101105 document . head . appendChild ( script ) ;
102106 } ) ;
107+ }
108+
109+ function flattenTargetArrays ( resultsArray ) {
110+ if ( Array . isArray ( resultsArray ) ) {
111+ resultsArray . forEach ( result => {
112+ if ( result . nodes && Array . isArray ( result . nodes ) ) {
113+ result . nodes . forEach ( node => {
114+ if ( node . target && Array . isArray ( node . target ) ) {
115+ node . target = node . target . flat ( ) ;
116+ }
117+ } ) ;
118+ }
119+ } ) ;
120+ }
103121}
You can’t perform that action at this time.
0 commit comments