Skip to content

Commit c5483ef

Browse files
committed
fix: allows to set a default element to run on the first load
This element will be used as the default context sent to `axe.run` Fix: vue-a11y#36
1 parent 7cad614 commit c5483ef

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/audit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function checkAndReport (options, node, label) {
1111
const deferred = createDeferred()
1212
style = { ...options.style }
1313

14-
axeCore.run(node || document, options.runOptions, (error, results) => {
14+
axeCore.run(node || options.element || document, options.runOptions, (error, results) => {
1515
if (error) deferred.reject(error)
1616
if (results && !results.violations.length) return
1717
if (JSON.stringify(results.violations) === lastNotification) return

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ export default function install (Vue, options = {}) {
4848
})
4949

5050
// First check
51-
setTimeout(() => draf(() => checkAndReport(options, document, 'App')), options.delay)
51+
setTimeout(() => draf(() => checkAndReport(options, null, 'App')), options.delay)
5252
}

src/utils.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const defaultOptions = {
77
allowConsoleClears: true,
88
clearConsoleOnUpdate: false,
99
delay: 500,
10+
element: null,
1011
config: {
1112
branding: {
1213
application: 'vue-axe'

0 commit comments

Comments
 (0)