@@ -21,9 +21,7 @@ export function checkAndReport (options, node) {
2121 }
2222
2323 options . customResultHandler ? options . customResultHandler ( error , results ) : standardResultHandler ( error , results )
24-
2524 deferred . resolve ( )
26-
2725 lastNotification = JSON . stringify ( results . violations )
2826 } )
2927 return deferred . promise
@@ -41,11 +39,11 @@ const standardResultHandler = function (errorInfo, results) {
4139 } )
4240
4341 if ( results . violations . length ) {
44- console . group ( '%cNew axe issues' , style . head )
4542 const violations = sortViolations ( results . violations )
43+ console . group ( '%cNew axe issues' , style . head )
4644 violations . forEach ( result => {
4745 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 => {
4947 failureSummary ( node , 'any' )
5048 failureSummary ( node , 'none' )
5149 } )
@@ -86,39 +84,39 @@ function failureSummary (node, key) {
8684 logFailureMessage ( node , key )
8785
8886 var relatedNodes = [ ]
89- node [ key ] . forEach ( function ( check ) {
87+ node [ key ] . forEach ( check => {
9088 relatedNodes = relatedNodes . concat ( check . relatedNodes )
9189 } )
9290
9391 if ( relatedNodes . length > 0 ) {
9492 console . groupCollapsed ( 'Related nodes' )
95- relatedNodes . forEach ( function ( relatedNode ) {
93+ relatedNodes . forEach ( relatedNode => {
9694 logElement ( relatedNode , console . log )
9795 logHtml ( relatedNode )
9896 } )
9997 console . groupEnd ( )
10098 }
101-
10299 console . groupEnd ( )
103100 }
104101}
105102
106103function logElement ( node , logFn ) {
107- var el = document . querySelector ( node . target . toString ( ) )
104+ const el = document . querySelector ( node . target . toString ( ) )
108105 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 ( ) )
112107 }
108+ logFn ( 'Element: %o' , el )
113109}
114110
115111function logHtml ( node ) {
116112 console . log ( 'HTML: %c%s' , style . boldCourier , node . html )
117113}
118114
119115function 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+ } ) )
123121 console . error ( message )
124122}
0 commit comments