@@ -21,9 +21,7 @@ export function checkAndReport (options, node) {
21
21
}
22
22
23
23
options . customResultHandler ? options . customResultHandler ( error , results ) : standardResultHandler ( error , results )
24
-
25
24
deferred . resolve ( )
26
-
27
25
lastNotification = JSON . stringify ( results . violations )
28
26
} )
29
27
return deferred . promise
@@ -41,11 +39,11 @@ const standardResultHandler = function (errorInfo, results) {
41
39
} )
42
40
43
41
if ( results . violations . length ) {
44
- console . group ( '%cNew axe issues' , style . head )
45
42
const violations = sortViolations ( results . violations )
43
+ console . group ( '%cNew axe issues' , style . head )
46
44
violations . forEach ( result => {
47
45
console . groupCollapsed ( '%c%s%c %s %s %c%s' , style [ result . impact || 'minor' ] , result . impact , style . title , result . help , '\n' , style . url , result . helpUrl )
48
- result . nodes . forEach ( function ( node ) {
46
+ result . nodes . forEach ( node => {
49
47
failureSummary ( node , 'any' )
50
48
failureSummary ( node , 'none' )
51
49
} )
@@ -86,39 +84,39 @@ function failureSummary (node, key) {
86
84
logFailureMessage ( node , key )
87
85
88
86
var relatedNodes = [ ]
89
- node [ key ] . forEach ( function ( check ) {
87
+ node [ key ] . forEach ( check => {
90
88
relatedNodes = relatedNodes . concat ( check . relatedNodes )
91
89
} )
92
90
93
91
if ( relatedNodes . length > 0 ) {
94
92
console . groupCollapsed ( 'Related nodes' )
95
- relatedNodes . forEach ( function ( relatedNode ) {
93
+ relatedNodes . forEach ( relatedNode => {
96
94
logElement ( relatedNode , console . log )
97
95
logHtml ( relatedNode )
98
96
} )
99
97
console . groupEnd ( )
100
98
}
101
-
102
99
console . groupEnd ( )
103
100
}
104
101
}
105
102
106
103
function logElement ( node , logFn ) {
107
- var el = document . querySelector ( node . target . toString ( ) )
104
+ const el = document . querySelector ( node . target . toString ( ) )
108
105
if ( ! el ) {
109
- logFn ( 'Selector: %c%s' , style . boldCourier , node . target . toString ( ) )
110
- } else {
111
- logFn ( 'Element: %o' , el )
106
+ return logFn ( 'Selector: %c%s' , style . boldCourier , node . target . toString ( ) )
112
107
}
108
+ logFn ( 'Element: %o' , el )
113
109
}
114
110
115
111
function logHtml ( node ) {
116
112
console . log ( 'HTML: %c%s' , style . boldCourier , node . html )
117
113
}
118
114
119
115
function logFailureMessage ( node , key ) {
120
- var message = axeCore . _audit . data . failureSummaries [ key ] . failureMessage ( node [ key ] . map ( function ( check ) {
121
- return check . message || ''
122
- } ) )
116
+ const message = axeCore . _audit . data . failureSummaries [ key ]
117
+ . failureMessage ( node [ key ]
118
+ . map ( function ( check ) {
119
+ return check . message || ''
120
+ } ) )
123
121
console . error ( message )
124
122
}
0 commit comments