File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export default function install (Vue, options) {
88 if ( typeof window === 'undefined' ) return
99
1010 const defaultOptions = {
11- clearConsoleOnUpdate : true ,
11+ clearConsoleOnUpdate : false ,
1212 config : {
1313 checks : [ {
1414 id : 'color-contrast' ,
@@ -43,22 +43,24 @@ export default function install (Vue, options) {
4343 updated ( ) {
4444 this . debounceAxe ( )
4545 } ,
46- // Used for change of route
4746 beforeDestroy ( ) {
4847 this . clearAxeConsole ( true )
4948 } ,
5049 methods : {
5150 clearAxeConsole ( forceClear = false ) {
5251 resetCache ( )
5352
54- if ( forceClear && options . clearConsoleOnUpdate ) {
53+ if ( forceClear || options . clearConsoleOnUpdate ) {
5554 console . clear ( )
5655 resetLastNotification ( )
5756 }
5857 } ,
58+ axeRun ( { clearConsole = false , element = document } = { } ) {
59+ this . clearAxeConsole ( clearConsole )
60+ this . $nextTick ( ( ) => checkAndReport ( options , element ) )
61+ } ,
5962 debounceAxe : debounce ( function ( ) {
60- this . clearAxeConsole ( )
61- this . $nextTick ( ( ) => checkAndReport ( options , this . $el ) )
63+ this . axeRun ( )
6264 } , 1000 , { maxWait : 5000 } )
6365 }
6466 } )
Original file line number Diff line number Diff line change @@ -2,16 +2,14 @@ import axeCore from 'axe-core'
22
33let cache = { }
44let style = { }
5- const nodes = [ ]
65const deferred = { }
76let lastNotification = ''
87
98export function checkAndReport ( options , node ) {
10- nodes . push ( node )
119 const deferred = createDeferred ( )
1210 style = { ...options . style }
1311
14- axeCore . run ( document , options . runOptions , ( error , results ) => {
12+ axeCore . run ( node || document , options . runOptions , ( error , results ) => {
1513 if ( error ) deferred . reject ( error )
1614 if ( ! results ) return
1715 if ( JSON . stringify ( results . violations ) === lastNotification ) return
You can’t perform that action at this time.
0 commit comments