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) {
10
10
results . device = device ( ) ;
11
11
results . browser = getBrowser ( ) ;
12
12
results . date = getFormattedDate ( ) ;
13
+
14
+ flattenTargetArrays ( results . violations ) ;
15
+ flattenTargetArrays ( results . incomplete ) ;
16
+ flattenTargetArrays ( results . inapplicable ) ;
13
17
return results ;
14
18
}
15
19
@@ -100,4 +104,18 @@ function injectAxeScript(scriptURL) {
100
104
script . addEventListener ( 'error' , e => reject ( e . error ) ) ;
101
105
document . head . appendChild ( script ) ;
102
106
} ) ;
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
+ }
103
121
}
You can’t perform that action at this time.
0 commit comments