File tree 2 files changed +8
-8
lines changed
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) {
8
8
if ( typeof window === 'undefined' ) return
9
9
10
10
const defaultOptions = {
11
- clearConsoleOnUpdate : true ,
11
+ clearConsoleOnUpdate : false ,
12
12
config : {
13
13
checks : [ {
14
14
id : 'color-contrast' ,
@@ -43,22 +43,24 @@ export default function install (Vue, options) {
43
43
updated ( ) {
44
44
this . debounceAxe ( )
45
45
} ,
46
- // Used for change of route
47
46
beforeDestroy ( ) {
48
47
this . clearAxeConsole ( true )
49
48
} ,
50
49
methods : {
51
50
clearAxeConsole ( forceClear = false ) {
52
51
resetCache ( )
53
52
54
- if ( forceClear && options . clearConsoleOnUpdate ) {
53
+ if ( forceClear || options . clearConsoleOnUpdate ) {
55
54
console . clear ( )
56
55
resetLastNotification ( )
57
56
}
58
57
} ,
58
+ axeRun ( { clearConsole = false , element = document } = { } ) {
59
+ this . clearAxeConsole ( clearConsole )
60
+ this . $nextTick ( ( ) => checkAndReport ( options , element ) )
61
+ } ,
59
62
debounceAxe : debounce ( function ( ) {
60
- this . clearAxeConsole ( )
61
- this . $nextTick ( ( ) => checkAndReport ( options , this . $el ) )
63
+ this . axeRun ( )
62
64
} , 1000 , { maxWait : 5000 } )
63
65
}
64
66
} )
Original file line number Diff line number Diff line change @@ -2,16 +2,14 @@ import axeCore from 'axe-core'
2
2
3
3
let cache = { }
4
4
let style = { }
5
- const nodes = [ ]
6
5
const deferred = { }
7
6
let lastNotification = ''
8
7
9
8
export function checkAndReport ( options , node ) {
10
- nodes . push ( node )
11
9
const deferred = createDeferred ( )
12
10
style = { ...options . style }
13
11
14
- axeCore . run ( document , options . runOptions , ( error , results ) => {
12
+ axeCore . run ( node || document , options . runOptions , ( error , results ) => {
15
13
if ( error ) deferred . reject ( error )
16
14
if ( ! results ) return
17
15
if ( JSON . stringify ( results . violations ) === lastNotification ) return
You can’t perform that action at this time.
0 commit comments