govuk_publishing_components 18.1.0 → 18.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/CHANGELOG.md +741 -0
- data/node_modules/axe-core/CONTRIBUTING.md +187 -0
- data/node_modules/axe-core/LICENSE +362 -0
- data/node_modules/axe-core/README.md +147 -0
- data/node_modules/axe-core/axe.d.ts +216 -0
- data/node_modules/axe-core/axe.js +15298 -0
- data/node_modules/axe-core/axe.min.js +12 -0
- data/node_modules/axe-core/bower.json +40 -0
- data/node_modules/axe-core/doc/API.md +798 -0
- data/node_modules/axe-core/doc/accessibility-supported.md +33 -0
- data/node_modules/axe-core/doc/act-rules-format.md +37 -0
- data/node_modules/axe-core/doc/aria-supported.md +23 -0
- data/node_modules/axe-core/doc/axelogo2018.png +0 -0
- data/node_modules/axe-core/doc/code-submission-guidelines.md +178 -0
- data/node_modules/axe-core/doc/developer-guide.md +500 -0
- data/node_modules/axe-core/doc/examples/chrome-debugging-protocol/README.md +13 -0
- data/node_modules/axe-core/doc/examples/chrome-debugging-protocol/axe-cdp.js +81 -0
- data/node_modules/axe-core/doc/examples/chrome-debugging-protocol/package.json +8 -0
- data/node_modules/axe-core/doc/examples/html-handlebars.md +164 -0
- data/node_modules/axe-core/doc/examples/jasmine/README.md +37 -0
- data/node_modules/axe-core/doc/examples/jasmine/package.json +20 -0
- data/node_modules/axe-core/doc/examples/jasmine/spec/a11y.js +36 -0
- data/node_modules/axe-core/doc/examples/jest_react/README.md +41 -0
- data/node_modules/axe-core/doc/examples/jest_react/link.js +7 -0
- data/node_modules/axe-core/doc/examples/jest_react/link.test.js +24 -0
- data/node_modules/axe-core/doc/examples/jest_react/package.json +28 -0
- data/node_modules/axe-core/doc/examples/jest_react/test-helpers.js +21 -0
- data/node_modules/axe-core/doc/examples/mocha/README.md +37 -0
- data/node_modules/axe-core/doc/examples/mocha/package.json +21 -0
- data/node_modules/axe-core/doc/examples/phantomjs/README.md +17 -0
- data/node_modules/axe-core/doc/examples/phantomjs/axe-phantom.js +51 -0
- data/node_modules/axe-core/doc/examples/phantomjs/package.json +19 -0
- data/node_modules/axe-core/doc/examples/puppeteer/README.md +12 -0
- data/node_modules/axe-core/doc/examples/puppeteer/axe-puppeteer.js +60 -0
- data/node_modules/axe-core/doc/examples/puppeteer/package.json +10 -0
- data/node_modules/axe-core/doc/examples/qunit/README.md +37 -0
- data/node_modules/axe-core/doc/examples/qunit/package.json +21 -0
- data/node_modules/axe-core/doc/plugins.md +123 -0
- data/node_modules/axe-core/doc/projects.md +44 -0
- data/node_modules/axe-core/doc/rule-descriptions.md +79 -0
- data/node_modules/axe-core/doc/rule-development.md +95 -0
- data/node_modules/axe-core/doc/rule-proposal.md +106 -0
- data/node_modules/axe-core/lib/checks/aria/abstractrole.js +1 -0
- data/node_modules/axe-core/lib/checks/aria/abstractrole.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/allowed-attr.js +39 -0
- data/node_modules/axe-core/lib/checks/aria/allowed-attr.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/aria-allowed-role.js +28 -0
- data/node_modules/axe-core/lib/checks/aria/aria-allowed-role.json +16 -0
- data/node_modules/axe-core/lib/checks/aria/aria-hidden-body.js +1 -0
- data/node_modules/axe-core/lib/checks/aria/aria-hidden-body.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/errormessage.js +33 -0
- data/node_modules/axe-core/lib/checks/aria/errormessage.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/has-widget-role.js +6 -0
- data/node_modules/axe-core/lib/checks/aria/has-widget-role.json +12 -0
- data/node_modules/axe-core/lib/checks/aria/implicit-role-fallback.js +6 -0
- data/node_modules/axe-core/lib/checks/aria/implicit-role-fallback.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/invalidrole.js +3 -0
- data/node_modules/axe-core/lib/checks/aria/invalidrole.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/required-attr.js +28 -0
- data/node_modules/axe-core/lib/checks/aria/required-attr.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/required-children.js +117 -0
- data/node_modules/axe-core/lib/checks/aria/required-children.json +15 -0
- data/node_modules/axe-core/lib/checks/aria/required-parent.js +87 -0
- data/node_modules/axe-core/lib/checks/aria/required-parent.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedattr.js +39 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedattr.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedrole.js +1 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedrole.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr-value.js +32 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr-value.json +12 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr.js +25 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr.json +12 -0
- data/node_modules/axe-core/lib/checks/aria/valid-scrollable-semantics.js +62 -0
- data/node_modules/axe-core/lib/checks/aria/valid-scrollable-semantics.json +12 -0
- data/node_modules/axe-core/lib/checks/color/color-contrast.js +70 -0
- data/node_modules/axe-core/lib/checks/color/color-contrast.json +24 -0
- data/node_modules/axe-core/lib/checks/color/link-in-text-block.js +85 -0
- data/node_modules/axe-core/lib/checks/color/link-in-text-block.json +19 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-appropriate.js +67 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-appropriate.json +11 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-valid.js +2 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-valid.json +11 -0
- data/node_modules/axe-core/lib/checks/forms/fieldset-after.js +25 -0
- data/node_modules/axe-core/lib/checks/forms/fieldset.js +109 -0
- data/node_modules/axe-core/lib/checks/forms/fieldset.json +12 -0
- data/node_modules/axe-core/lib/checks/forms/group-labelledby-after.js +16 -0
- data/node_modules/axe-core/lib/checks/forms/group-labelledby.js +66 -0
- data/node_modules/axe-core/lib/checks/forms/group-labelledby.json +12 -0
- data/node_modules/axe-core/lib/checks/keyboard/accesskeys-after.js +19 -0
- data/node_modules/axe-core/lib/checks/keyboard/accesskeys.js +5 -0
- data/node_modules/axe-core/lib/checks/keyboard/accesskeys.json +12 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-disabled.js +25 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-disabled.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-no-name.js +6 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-no-name.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-not-tabbable.js +25 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-not-tabbable.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/landmark-is-top-level.js +18 -0
- data/node_modules/axe-core/lib/checks/keyboard/landmark-is-top-level.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-elm-after.js +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-elm.js +9 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-heading-one.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-main.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate-banner.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate-contentinfo.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate-main.json +14 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js +22 -0
- data/node_modules/axe-core/lib/checks/keyboard/tabindex.js +1 -0
- data/node_modules/axe-core/lib/checks/keyboard/tabindex.json +11 -0
- data/node_modules/axe-core/lib/checks/label/alt-space-value.js +2 -0
- data/node_modules/axe-core/lib/checks/label/alt-space-value.json +11 -0
- data/node_modules/axe-core/lib/checks/label/duplicate-img-label.js +19 -0
- data/node_modules/axe-core/lib/checks/label/duplicate-img-label.json +11 -0
- data/node_modules/axe-core/lib/checks/label/explicit.js +15 -0
- data/node_modules/axe-core/lib/checks/label/explicit.json +11 -0
- data/node_modules/axe-core/lib/checks/label/help-same-as-label.js +23 -0
- data/node_modules/axe-core/lib/checks/label/help-same-as-label.json +12 -0
- data/node_modules/axe-core/lib/checks/label/hidden-explicit-label.js +12 -0
- data/node_modules/axe-core/lib/checks/label/hidden-explicit-label.json +11 -0
- data/node_modules/axe-core/lib/checks/label/implicit.js +7 -0
- data/node_modules/axe-core/lib/checks/label/implicit.json +11 -0
- data/node_modules/axe-core/lib/checks/label/label-content-name-mismatch.js +49 -0
- data/node_modules/axe-core/lib/checks/label/label-content-name-mismatch.json +11 -0
- data/node_modules/axe-core/lib/checks/label/multiple-label.js +29 -0
- data/node_modules/axe-core/lib/checks/label/multiple-label.json +11 -0
- data/node_modules/axe-core/lib/checks/label/title-only.js +5 -0
- data/node_modules/axe-core/lib/checks/label/title-only.json +11 -0
- data/node_modules/axe-core/lib/checks/language/has-lang.js +5 -0
- data/node_modules/axe-core/lib/checks/language/has-lang.json +11 -0
- data/node_modules/axe-core/lib/checks/language/valid-lang.js +26 -0
- data/node_modules/axe-core/lib/checks/language/valid-lang.json +11 -0
- data/node_modules/axe-core/lib/checks/language/xml-lang-mismatch.js +5 -0
- data/node_modules/axe-core/lib/checks/language/xml-lang-mismatch.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/dlitem.js +23 -0
- data/node_modules/axe-core/lib/checks/lists/dlitem.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/listitem.js +18 -0
- data/node_modules/axe-core/lib/checks/lists/listitem.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/only-dlitems.js +42 -0
- data/node_modules/axe-core/lib/checks/lists/only-dlitems.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/only-listitems.js +68 -0
- data/node_modules/axe-core/lib/checks/lists/only-listitems.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/structured-dlitems.js +22 -0
- data/node_modules/axe-core/lib/checks/lists/structured-dlitems.json +11 -0
- data/node_modules/axe-core/lib/checks/media/caption.js +8 -0
- data/node_modules/axe-core/lib/checks/media/caption.json +11 -0
- data/node_modules/axe-core/lib/checks/media/description.js +8 -0
- data/node_modules/axe-core/lib/checks/media/description.json +11 -0
- data/node_modules/axe-core/lib/checks/media/frame-tested.js +28 -0
- data/node_modules/axe-core/lib/checks/media/frame-tested.json +15 -0
- data/node_modules/axe-core/lib/checks/mobile/css-orientation-lock.js +132 -0
- data/node_modules/axe-core/lib/checks/mobile/css-orientation-lock.json +12 -0
- data/node_modules/axe-core/lib/checks/mobile/meta-viewport-large.json +15 -0
- data/node_modules/axe-core/lib/checks/mobile/meta-viewport-scale.js +38 -0
- data/node_modules/axe-core/lib/checks/mobile/meta-viewport.json +14 -0
- data/node_modules/axe-core/lib/checks/navigation/header-present.js +4 -0
- data/node_modules/axe-core/lib/checks/navigation/header-present.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/heading-order-after.js +14 -0
- data/node_modules/axe-core/lib/checks/navigation/heading-order.js +15 -0
- data/node_modules/axe-core/lib/checks/navigation/heading-order.json +12 -0
- data/node_modules/axe-core/lib/checks/navigation/internal-link-present.js +4 -0
- data/node_modules/axe-core/lib/checks/navigation/internal-link-present.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/landmark.js +3 -0
- data/node_modules/axe-core/lib/checks/navigation/landmark.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/meta-refresh.js +4 -0
- data/node_modules/axe-core/lib/checks/navigation/meta-refresh.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/p-as-heading.js +93 -0
- data/node_modules/axe-core/lib/checks/navigation/p-as-heading.json +30 -0
- data/node_modules/axe-core/lib/checks/navigation/region-after.js +1 -0
- data/node_modules/axe-core/lib/checks/navigation/region.js +85 -0
- data/node_modules/axe-core/lib/checks/navigation/region.json +12 -0
- data/node_modules/axe-core/lib/checks/navigation/skip-link.js +5 -0
- data/node_modules/axe-core/lib/checks/navigation/skip-link.json +12 -0
- data/node_modules/axe-core/lib/checks/navigation/unique-frame-title-after.js +9 -0
- data/node_modules/axe-core/lib/checks/navigation/unique-frame-title.js +6 -0
- data/node_modules/axe-core/lib/checks/navigation/unique-frame-title.json +12 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id-active.json +12 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id-after.js +8 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id-aria.json +12 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id.js +17 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id.json +12 -0
- data/node_modules/axe-core/lib/checks/shared/aria-label.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/aria-label.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/aria-labelledby.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/aria-labelledby.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/button-has-visible-text.js +12 -0
- data/node_modules/axe-core/lib/checks/shared/button-has-visible-text.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/doc-has-title.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/doc-has-title.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/exists.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/exists.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/has-alt.js +4 -0
- data/node_modules/axe-core/lib/checks/shared/has-alt.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/has-visible-text.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/has-visible-text.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/is-on-screen.js +4 -0
- data/node_modules/axe-core/lib/checks/shared/is-on-screen.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-alt.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-alt.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-if-present.js +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-if-present.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-title.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-title.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-value.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-value.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/role-none.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/role-none.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/role-presentation.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/role-presentation.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/caption-faked.js +10 -0
- data/node_modules/axe-core/lib/checks/tables/caption-faked.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/has-caption.js +1 -0
- data/node_modules/axe-core/lib/checks/tables/has-caption.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/has-summary.js +1 -0
- data/node_modules/axe-core/lib/checks/tables/has-summary.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/has-th.js +31 -0
- data/node_modules/axe-core/lib/checks/tables/has-th.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/headers-visible-text.js +30 -0
- data/node_modules/axe-core/lib/checks/tables/html5-scope.js +5 -0
- data/node_modules/axe-core/lib/checks/tables/html5-scope.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/same-caption-summary.js +7 -0
- data/node_modules/axe-core/lib/checks/tables/same-caption-summary.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/scope-value.js +5 -0
- data/node_modules/axe-core/lib/checks/tables/scope-value.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/td-has-header.js +29 -0
- data/node_modules/axe-core/lib/checks/tables/td-has-header.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/td-headers-attr.js +62 -0
- data/node_modules/axe-core/lib/checks/tables/td-headers-attr.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/th-has-data-cells.js +76 -0
- data/node_modules/axe-core/lib/checks/tables/th-has-data-cells.json +12 -0
- data/node_modules/axe-core/lib/checks/tables/th-single-row-column.js +39 -0
- data/node_modules/axe-core/lib/checks/visibility/hidden-content.js +21 -0
- data/node_modules/axe-core/lib/checks/visibility/hidden-content.json +12 -0
- data/node_modules/axe-core/lib/commons/aria/arialabel-text.js +15 -0
- data/node_modules/axe-core/lib/commons/aria/arialabelledby-text.js +52 -0
- data/node_modules/axe-core/lib/commons/aria/attributes.js +45 -0
- data/node_modules/axe-core/lib/commons/aria/get-element-unallowed-roles.js +92 -0
- data/node_modules/axe-core/lib/commons/aria/get-owned-virtual.js +24 -0
- data/node_modules/axe-core/lib/commons/aria/get-role.js +44 -0
- data/node_modules/axe-core/lib/commons/aria/index.js +2417 -0
- data/node_modules/axe-core/lib/commons/aria/is-accessible-ref.js +55 -0
- data/node_modules/axe-core/lib/commons/aria/is-aria-role-allowed-on-element.js +41 -0
- data/node_modules/axe-core/lib/commons/aria/is-unsupported-role.js +14 -0
- data/node_modules/axe-core/lib/commons/aria/label-virtual.js +54 -0
- data/node_modules/axe-core/lib/commons/aria/named-from-contents.js +39 -0
- data/node_modules/axe-core/lib/commons/aria/roles.js +208 -0
- data/node_modules/axe-core/lib/commons/aria/validate-attr-value.js +63 -0
- data/node_modules/axe-core/lib/commons/color/contrast.js +172 -0
- data/node_modules/axe-core/lib/commons/color/element-is-distinct.js +88 -0
- data/node_modules/axe-core/lib/commons/color/get-background-color.js +411 -0
- data/node_modules/axe-core/lib/commons/color/get-foreground-color.js +32 -0
- data/node_modules/axe-core/lib/commons/color/incomplete-data.js +50 -0
- data/node_modules/axe-core/lib/commons/color/index.js +8 -0
- data/node_modules/axe-core/lib/commons/dom/elements-below-floating.js +39 -0
- data/node_modules/axe-core/lib/commons/dom/find-elms-in-context.js +28 -0
- data/node_modules/axe-core/lib/commons/dom/find-up.js +63 -0
- data/node_modules/axe-core/lib/commons/dom/get-composed-parent.js +25 -0
- data/node_modules/axe-core/lib/commons/dom/get-element-by-reference.js +34 -0
- data/node_modules/axe-core/lib/commons/dom/get-element-coordinates.js +38 -0
- data/node_modules/axe-core/lib/commons/dom/get-root-node.js +12 -0
- data/node_modules/axe-core/lib/commons/dom/get-scroll-offset.js +34 -0
- data/node_modules/axe-core/lib/commons/dom/get-tabbable-elements.js +24 -0
- data/node_modules/axe-core/lib/commons/dom/get-viewport-size.js +37 -0
- data/node_modules/axe-core/lib/commons/dom/has-content-virtual.js +73 -0
- data/node_modules/axe-core/lib/commons/dom/idrefs.js +36 -0
- data/node_modules/axe-core/lib/commons/dom/index.js +9 -0
- data/node_modules/axe-core/lib/commons/dom/is-focusable.js +90 -0
- data/node_modules/axe-core/lib/commons/dom/is-hidden-with-css.js +60 -0
- data/node_modules/axe-core/lib/commons/dom/is-html5.js +17 -0
- data/node_modules/axe-core/lib/commons/dom/is-in-text-block.js +95 -0
- data/node_modules/axe-core/lib/commons/dom/is-node.js +13 -0
- data/node_modules/axe-core/lib/commons/dom/is-offscreen.js +62 -0
- data/node_modules/axe-core/lib/commons/dom/is-visible.js +77 -0
- data/node_modules/axe-core/lib/commons/dom/is-visual-content.js +50 -0
- data/node_modules/axe-core/lib/commons/dom/shadow-elements-from-point.js +41 -0
- data/node_modules/axe-core/lib/commons/dom/visually-contains.js +62 -0
- data/node_modules/axe-core/lib/commons/dom/visually-overlaps.js +47 -0
- data/node_modules/axe-core/lib/commons/index.js +11 -0
- data/node_modules/axe-core/lib/commons/intro.stub +1 -0
- data/node_modules/axe-core/lib/commons/matches/attributes.js +23 -0
- data/node_modules/axe-core/lib/commons/matches/condition.js +19 -0
- data/node_modules/axe-core/lib/commons/matches/from-definition.js +47 -0
- data/node_modules/axe-core/lib/commons/matches/from-function.js +38 -0
- data/node_modules/axe-core/lib/commons/matches/from-primative.js +30 -0
- data/node_modules/axe-core/lib/commons/matches/index.js +37 -0
- data/node_modules/axe-core/lib/commons/matches/node-name.js +34 -0
- data/node_modules/axe-core/lib/commons/matches/properties.js +25 -0
- data/node_modules/axe-core/lib/commons/outro.stub +2 -0
- data/node_modules/axe-core/lib/commons/table/get-all-cells.js +28 -0
- data/node_modules/axe-core/lib/commons/table/get-cell-position.js +28 -0
- data/node_modules/axe-core/lib/commons/table/get-headers.js +29 -0
- data/node_modules/axe-core/lib/commons/table/get-scope.js +54 -0
- data/node_modules/axe-core/lib/commons/table/index.js +9 -0
- data/node_modules/axe-core/lib/commons/table/is-column-header.js +13 -0
- data/node_modules/axe-core/lib/commons/table/is-data-cell.js +22 -0
- data/node_modules/axe-core/lib/commons/table/is-data-table.js +190 -0
- data/node_modules/axe-core/lib/commons/table/is-header.js +22 -0
- data/node_modules/axe-core/lib/commons/table/is-row-header.js +13 -0
- data/node_modules/axe-core/lib/commons/table/to-grid.js +38 -0
- data/node_modules/axe-core/lib/commons/table/traverse.js +78 -0
- data/node_modules/axe-core/lib/commons/text/accessible-text-virtual.js +152 -0
- data/node_modules/axe-core/lib/commons/text/form-control-value.js +204 -0
- data/node_modules/axe-core/lib/commons/text/index.js +8 -0
- data/node_modules/axe-core/lib/commons/text/is-human-interpretable.js +51 -0
- data/node_modules/axe-core/lib/commons/text/is-valid-autocomplete.js +118 -0
- data/node_modules/axe-core/lib/commons/text/label-text.js +58 -0
- data/node_modules/axe-core/lib/commons/text/label-virtual.js +53 -0
- data/node_modules/axe-core/lib/commons/text/native-element-types.js +100 -0
- data/node_modules/axe-core/lib/commons/text/native-text-alternative.js +50 -0
- data/node_modules/axe-core/lib/commons/text/native-text-methods.js +122 -0
- data/node_modules/axe-core/lib/commons/text/sanitize.js +18 -0
- data/node_modules/axe-core/lib/commons/text/subtree-text.js +89 -0
- data/node_modules/axe-core/lib/commons/text/title-text.js +33 -0
- data/node_modules/axe-core/lib/commons/text/unicode.js +117 -0
- data/node_modules/axe-core/lib/commons/text/unsupported.js +5 -0
- data/node_modules/axe-core/lib/commons/text/visible-virtual.js +46 -0
- data/node_modules/axe-core/lib/commons/utils/index.js +10 -0
- data/node_modules/axe-core/lib/core/base/audit.js +684 -0
- data/node_modules/axe-core/lib/core/base/check-result.js +33 -0
- data/node_modules/axe-core/lib/core/base/check.js +123 -0
- data/node_modules/axe-core/lib/core/base/context.js +273 -0
- data/node_modules/axe-core/lib/core/base/rule-result.js +39 -0
- data/node_modules/axe-core/lib/core/base/rule.js +383 -0
- data/node_modules/axe-core/lib/core/constants.js +68 -0
- data/node_modules/axe-core/lib/core/imports/index.js +26 -0
- data/node_modules/axe-core/lib/core/index.js +45 -0
- data/node_modules/axe-core/lib/core/log.js +12 -0
- data/node_modules/axe-core/lib/core/public/cleanup-plugins.js +53 -0
- data/node_modules/axe-core/lib/core/public/configure.js +57 -0
- data/node_modules/axe-core/lib/core/public/get-rules.js +29 -0
- data/node_modules/axe-core/lib/core/public/load.js +66 -0
- data/node_modules/axe-core/lib/core/public/plugins.js +47 -0
- data/node_modules/axe-core/lib/core/public/reporter.js +24 -0
- data/node_modules/axe-core/lib/core/public/reset.js +12 -0
- data/node_modules/axe-core/lib/core/public/run-rules.js +94 -0
- data/node_modules/axe-core/lib/core/public/run.js +148 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/failure-summary.js +35 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/get-environment-data.js +39 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/incomplete-fallback-msg.js +11 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/index.js +3 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/process-aggregate.js +102 -0
- data/node_modules/axe-core/lib/core/reporters/na.js +20 -0
- data/node_modules/axe-core/lib/core/reporters/no-passes.js +18 -0
- data/node_modules/axe-core/lib/core/reporters/raw.js +8 -0
- data/node_modules/axe-core/lib/core/reporters/v1.js +26 -0
- data/node_modules/axe-core/lib/core/reporters/v2.js +22 -0
- data/node_modules/axe-core/lib/core/utils/aggregate.js +19 -0
- data/node_modules/axe-core/lib/core/utils/aggregateChecks.js +85 -0
- data/node_modules/axe-core/lib/core/utils/aggregateNodeResults.js +61 -0
- data/node_modules/axe-core/lib/core/utils/aggregateResult.js +37 -0
- data/node_modules/axe-core/lib/core/utils/are-styles-set.js +24 -0
- data/node_modules/axe-core/lib/core/utils/check-helper.js +38 -0
- data/node_modules/axe-core/lib/core/utils/clone.js +27 -0
- data/node_modules/axe-core/lib/core/utils/collect-results-from-frames.js +127 -0
- data/node_modules/axe-core/lib/core/utils/contains.js +30 -0
- data/node_modules/axe-core/lib/core/utils/css-parser.js +5 -0
- data/node_modules/axe-core/lib/core/utils/dq-element.js +97 -0
- data/node_modules/axe-core/lib/core/utils/element-matches.js +39 -0
- data/node_modules/axe-core/lib/core/utils/escape-selector.js +79 -0
- data/node_modules/axe-core/lib/core/utils/extend-meta-data.js +17 -0
- data/node_modules/axe-core/lib/core/utils/finalize-result.js +11 -0
- data/node_modules/axe-core/lib/core/utils/find-by.js +14 -0
- data/node_modules/axe-core/lib/core/utils/flattened-tree.js +170 -0
- data/node_modules/axe-core/lib/core/utils/get-all-checks.js +12 -0
- data/node_modules/axe-core/lib/core/utils/get-base-lang.js +16 -0
- data/node_modules/axe-core/lib/core/utils/get-check-option.js +40 -0
- data/node_modules/axe-core/lib/core/utils/get-friendly-uri-end.js +144 -0
- data/node_modules/axe-core/lib/core/utils/get-root-node.js +17 -0
- data/node_modules/axe-core/lib/core/utils/get-selector.js +406 -0
- data/node_modules/axe-core/lib/core/utils/get-xpath.js +84 -0
- data/node_modules/axe-core/lib/core/utils/index.js +10 -0
- data/node_modules/axe-core/lib/core/utils/inject-style.js +38 -0
- data/node_modules/axe-core/lib/core/utils/is-hidden.js +40 -0
- data/node_modules/axe-core/lib/core/utils/is-html-element.js +135 -0
- data/node_modules/axe-core/lib/core/utils/is-shadow-root.js +40 -0
- data/node_modules/axe-core/lib/core/utils/is-xhtml.js +14 -0
- data/node_modules/axe-core/lib/core/utils/merge-results.js +116 -0
- data/node_modules/axe-core/lib/core/utils/node-sorter.js +21 -0
- data/node_modules/axe-core/lib/core/utils/performance-timer.js +121 -0
- data/node_modules/axe-core/lib/core/utils/pollyfills.js +299 -0
- data/node_modules/axe-core/lib/core/utils/preload-cssom.js +456 -0
- data/node_modules/axe-core/lib/core/utils/preload.js +109 -0
- data/node_modules/axe-core/lib/core/utils/publish-metadata.js +93 -0
- data/node_modules/axe-core/lib/core/utils/qsa.js +322 -0
- data/node_modules/axe-core/lib/core/utils/queue.js +138 -0
- data/node_modules/axe-core/lib/core/utils/respondable.js +243 -0
- data/node_modules/axe-core/lib/core/utils/rule-should-run.js +83 -0
- data/node_modules/axe-core/lib/core/utils/scroll-state.js +70 -0
- data/node_modules/axe-core/lib/core/utils/select.js +146 -0
- data/node_modules/axe-core/lib/core/utils/to-array.js +21 -0
- data/node_modules/axe-core/lib/core/utils/token-list.js +15 -0
- data/node_modules/axe-core/lib/core/utils/uuid.js +242 -0
- data/node_modules/axe-core/lib/core/utils/valid-input-type.js +35 -0
- data/node_modules/axe-core/lib/core/utils/valid-langs.js +8152 -0
- data/node_modules/axe-core/lib/intro.stub +15 -0
- data/node_modules/axe-core/lib/misc/any-failure-summary.json +6 -0
- data/node_modules/axe-core/lib/misc/incomplete-fallback.json +3 -0
- data/node_modules/axe-core/lib/misc/none-failure-summary.json +6 -0
- data/node_modules/axe-core/lib/outro.stub +2 -0
- data/node_modules/axe-core/lib/rules/accesskeys.json +13 -0
- data/node_modules/axe-core/lib/rules/area-alt.json +19 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-attr-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-role-matches.js +7 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-role.json +14 -0
- data/node_modules/axe-core/lib/rules/aria-dpub-role-fallback-matches.js +10 -0
- data/node_modules/axe-core/lib/rules/aria-dpub-role-fallback.json +13 -0
- data/node_modules/axe-core/lib/rules/aria-has-attr-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/aria-hidden-body.json +13 -0
- data/node_modules/axe-core/lib/rules/aria-hidden-focus-matches.js +18 -0
- data/node_modules/axe-core/lib/rules/aria-hidden-focus.json +14 -0
- data/node_modules/axe-core/lib/rules/aria-required-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-required-children.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-required-parent.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-roles.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-valid-attr-value.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-valid-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/audio-caption.json +20 -0
- data/node_modules/axe-core/lib/rules/autocomplete-matches.js +45 -0
- data/node_modules/axe-core/lib/rules/autocomplete-valid.json +12 -0
- data/node_modules/axe-core/lib/rules/blink.json +19 -0
- data/node_modules/axe-core/lib/rules/button-name.json +27 -0
- data/node_modules/axe-core/lib/rules/bypass-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/bypass.json +20 -0
- data/node_modules/axe-core/lib/rules/checkboxgroup.json +12 -0
- data/node_modules/axe-core/lib/rules/color-contrast-matches.js +120 -0
- data/node_modules/axe-core/lib/rules/color-contrast.json +16 -0
- data/node_modules/axe-core/lib/rules/css-orientation-lock.json +13 -0
- data/node_modules/axe-core/lib/rules/data-table-large-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/data-table-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/definition-list.json +13 -0
- data/node_modules/axe-core/lib/rules/dlitem.json +13 -0
- data/node_modules/axe-core/lib/rules/document-title.json +13 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-active-matches.js +8 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-active.json +14 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-aria-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-aria.json +14 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-misc-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/duplicate-id.json +14 -0
- data/node_modules/axe-core/lib/rules/empty-heading.json +13 -0
- data/node_modules/axe-core/lib/rules/focus-order-semantics.json +13 -0
- data/node_modules/axe-core/lib/rules/form-field-multiple-labels.json +13 -0
- data/node_modules/axe-core/lib/rules/frame-tested.json +12 -0
- data/node_modules/axe-core/lib/rules/frame-title-has-text.js +2 -0
- data/node_modules/axe-core/lib/rules/frame-title-unique.json +13 -0
- data/node_modules/axe-core/lib/rules/frame-title.json +25 -0
- data/node_modules/axe-core/lib/rules/heading-matches.js +15 -0
- data/node_modules/axe-core/lib/rules/heading-order.json +13 -0
- data/node_modules/axe-core/lib/rules/hidden-content.json +13 -0
- data/node_modules/axe-core/lib/rules/html-has-lang.json +12 -0
- data/node_modules/axe-core/lib/rules/html-lang-valid.json +12 -0
- data/node_modules/axe-core/lib/rules/html-xml-lang-mismatch.json +13 -0
- data/node_modules/axe-core/lib/rules/image-alt.json +25 -0
- data/node_modules/axe-core/lib/rules/img-redundant-alt.json +12 -0
- data/node_modules/axe-core/lib/rules/input-image-alt.json +18 -0
- data/node_modules/axe-core/lib/rules/inserted-into-focus-order-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/label-content-name-mismatch-matches.js +42 -0
- data/node_modules/axe-core/lib/rules/label-content-name-mismatch.json +12 -0
- data/node_modules/axe-core/lib/rules/label-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/label-title-only.json +13 -0
- data/node_modules/axe-core/lib/rules/label.json +26 -0
- data/node_modules/axe-core/lib/rules/landmark-banner-is-top-level.json +13 -0
- data/node_modules/axe-core/lib/rules/landmark-complementary-is-top-level.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-contentinfo-is-top-level.json +13 -0
- data/node_modules/axe-core/lib/rules/landmark-has-body-context.js +8 -0
- data/node_modules/axe-core/lib/rules/landmark-main-is-top-level.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-no-duplicate-banner.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-no-duplicate-contentinfo.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-one-main.json +12 -0
- data/node_modules/axe-core/lib/rules/layout-table-matches.js +8 -0
- data/node_modules/axe-core/lib/rules/layout-table.json +13 -0
- data/node_modules/axe-core/lib/rules/link-in-text-block-matches.js +14 -0
- data/node_modules/axe-core/lib/rules/link-in-text-block.json +14 -0
- data/node_modules/axe-core/lib/rules/link-name.json +26 -0
- data/node_modules/axe-core/lib/rules/list.json +13 -0
- data/node_modules/axe-core/lib/rules/listitem.json +13 -0
- data/node_modules/axe-core/lib/rules/marquee.json +13 -0
- data/node_modules/axe-core/lib/rules/meta-refresh.json +13 -0
- data/node_modules/axe-core/lib/rules/meta-viewport-large.json +13 -0
- data/node_modules/axe-core/lib/rules/meta-viewport.json +13 -0
- data/node_modules/axe-core/lib/rules/no-role-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/not-html-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/object-alt.json +25 -0
- data/node_modules/axe-core/lib/rules/p-as-heading-matches.js +17 -0
- data/node_modules/axe-core/lib/rules/p-as-heading.json +13 -0
- data/node_modules/axe-core/lib/rules/page-has-heading-one.json +12 -0
- data/node_modules/axe-core/lib/rules/radiogroup.json +12 -0
- data/node_modules/axe-core/lib/rules/region.json +13 -0
- data/node_modules/axe-core/lib/rules/role-not-button-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/scope-attr-valid.json +12 -0
- data/node_modules/axe-core/lib/rules/server-side-image-map.json +18 -0
- data/node_modules/axe-core/lib/rules/skip-link-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/skip-link.json +13 -0
- data/node_modules/axe-core/lib/rules/tabindex.json +12 -0
- data/node_modules/axe-core/lib/rules/table-duplicate-name.json +12 -0
- data/node_modules/axe-core/lib/rules/table-fake-caption.json +20 -0
- data/node_modules/axe-core/lib/rules/td-has-header.json +20 -0
- data/node_modules/axe-core/lib/rules/td-headers-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/th-has-data-cells.json +13 -0
- data/node_modules/axe-core/lib/rules/valid-lang.json +13 -0
- data/node_modules/axe-core/lib/rules/video-caption.json +19 -0
- data/node_modules/axe-core/lib/rules/video-description.json +19 -0
- data/node_modules/axe-core/lib/rules/window-is-top.js +3 -0
- data/node_modules/axe-core/lib/rules/xml-lang-mismatch-matches.js +12 -0
- data/node_modules/axe-core/locales/de.json +627 -0
- data/node_modules/axe-core/locales/fr.json +667 -0
- data/node_modules/axe-core/locales/ja.json +728 -0
- data/node_modules/axe-core/locales/nl.json +36 -0
- data/node_modules/axe-core/package.json +215 -0
- data/node_modules/axe-core/sri-history.json +138 -0
- data/node_modules/axe-core/typings/axe-core/axe-core-tests.ts +180 -0
- metadata +511 -1
@@ -0,0 +1,684 @@
|
|
1
|
+
/*global Rule, Check, RuleResult, commons: true */
|
2
|
+
/*eslint no-unused-vars: 0*/
|
3
|
+
function getDefaultConfiguration(audit) {
|
4
|
+
'use strict';
|
5
|
+
var config;
|
6
|
+
if (audit) {
|
7
|
+
config = axe.utils.clone(audit);
|
8
|
+
// Commons are configured into axe like everything else,
|
9
|
+
// however because things go funky if we have multiple commons objects
|
10
|
+
// we're not using the copy of that.
|
11
|
+
config.commons = audit.commons;
|
12
|
+
} else {
|
13
|
+
config = {};
|
14
|
+
}
|
15
|
+
|
16
|
+
config.reporter = config.reporter || null;
|
17
|
+
config.rules = config.rules || [];
|
18
|
+
config.checks = config.checks || [];
|
19
|
+
config.data = { checks: {}, rules: {}, ...config.data };
|
20
|
+
return config;
|
21
|
+
}
|
22
|
+
|
23
|
+
function unpackToObject(collection, audit, method) {
|
24
|
+
'use strict';
|
25
|
+
|
26
|
+
var i, l;
|
27
|
+
for (i = 0, l = collection.length; i < l; i++) {
|
28
|
+
audit[method](collection[i]);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Constructor which holds configured rules and information about the document under test
|
34
|
+
*/
|
35
|
+
function Audit(audit) {
|
36
|
+
// defaults
|
37
|
+
this.brand = 'axe';
|
38
|
+
this.application = 'axeAPI';
|
39
|
+
this.tagExclude = ['experimental'];
|
40
|
+
|
41
|
+
this.defaultConfig = audit;
|
42
|
+
this._init();
|
43
|
+
|
44
|
+
// A copy of the "default" locale. This will be set if the user
|
45
|
+
// provides a new locale to `axe.configure()` and used to undo
|
46
|
+
// changes in `axe.reset()`.
|
47
|
+
this._defaultLocale = null;
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Build and set the previous locale. Will noop if a previous
|
52
|
+
* locale was already set, as we want the ability to "reset"
|
53
|
+
* to the default ("first") configuration.
|
54
|
+
*/
|
55
|
+
|
56
|
+
Audit.prototype._setDefaultLocale = function() {
|
57
|
+
if (this._defaultLocale) {
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
|
61
|
+
const locale = {
|
62
|
+
checks: {},
|
63
|
+
rules: {}
|
64
|
+
};
|
65
|
+
|
66
|
+
// XXX: unable to use `for-of` here, as doing so would
|
67
|
+
// require us to polyfill `Symbol`.
|
68
|
+
const checkIDs = Object.keys(this.data.checks);
|
69
|
+
for (let i = 0; i < checkIDs.length; i++) {
|
70
|
+
const id = checkIDs[i];
|
71
|
+
const check = this.data.checks[id];
|
72
|
+
const { pass, fail, incomplete } = check.messages;
|
73
|
+
locale.checks[id] = {
|
74
|
+
pass,
|
75
|
+
fail,
|
76
|
+
incomplete
|
77
|
+
};
|
78
|
+
}
|
79
|
+
|
80
|
+
const ruleIDs = Object.keys(this.data.rules);
|
81
|
+
for (let i = 0; i < ruleIDs.length; i++) {
|
82
|
+
const id = ruleIDs[i];
|
83
|
+
const rule = this.data.rules[id];
|
84
|
+
const { description, help } = rule;
|
85
|
+
locale.rules[id] = { description, help };
|
86
|
+
}
|
87
|
+
|
88
|
+
this._defaultLocale = locale;
|
89
|
+
};
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Reset the locale to the "default".
|
93
|
+
*/
|
94
|
+
|
95
|
+
Audit.prototype._resetLocale = function() {
|
96
|
+
// If the default locale has not already been set, we can exit early.
|
97
|
+
const defaultLocale = this._defaultLocale;
|
98
|
+
if (!defaultLocale) {
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
|
102
|
+
// Apply the default locale
|
103
|
+
this.applyLocale(defaultLocale);
|
104
|
+
};
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Merge two check locales (a, b), favoring `b`.
|
108
|
+
*
|
109
|
+
* Both locale `a` and the returned shape resemble:
|
110
|
+
*
|
111
|
+
* {
|
112
|
+
* impact: string,
|
113
|
+
* messages: {
|
114
|
+
* pass: string | function,
|
115
|
+
* fail: string | function,
|
116
|
+
* incomplete: string | {
|
117
|
+
* [key: string]: string | function
|
118
|
+
* }
|
119
|
+
* }
|
120
|
+
* }
|
121
|
+
*
|
122
|
+
* Locale `b` follows the `axe.CheckLocale` shape and resembles:
|
123
|
+
*
|
124
|
+
* {
|
125
|
+
* pass: string,
|
126
|
+
* fail: string,
|
127
|
+
* incomplete: string | { [key: string]: string }
|
128
|
+
* }
|
129
|
+
*/
|
130
|
+
|
131
|
+
const mergeCheckLocale = (a, b) => {
|
132
|
+
let { pass, fail } = b;
|
133
|
+
// If the message(s) are Strings, they have not yet been run
|
134
|
+
// thru doT (which will return a Function).
|
135
|
+
if (typeof pass === 'string') {
|
136
|
+
pass = axe.imports.doT.compile(pass);
|
137
|
+
}
|
138
|
+
if (typeof fail === 'string') {
|
139
|
+
fail = axe.imports.doT.compile(fail);
|
140
|
+
}
|
141
|
+
return {
|
142
|
+
...a,
|
143
|
+
messages: {
|
144
|
+
pass: pass || a.messages.pass,
|
145
|
+
fail: fail || a.messages.fail,
|
146
|
+
incomplete:
|
147
|
+
typeof a.messages.incomplete === 'object'
|
148
|
+
? // TODO: for compleness-sake, we should be running
|
149
|
+
// incomplete messages thru doT as well. This was
|
150
|
+
// out-of-scope for runtime localization, but should
|
151
|
+
// eventually be addressed.
|
152
|
+
{ ...a.messages.incomplete, ...b.incomplete }
|
153
|
+
: b.incomplete
|
154
|
+
}
|
155
|
+
};
|
156
|
+
};
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Merge two rule locales (a, b), favoring `b`.
|
160
|
+
*/
|
161
|
+
|
162
|
+
const mergeRuleLocale = (a, b) => {
|
163
|
+
let { help, description } = b;
|
164
|
+
// If the message(s) are Strings, they have not yet been run
|
165
|
+
// thru doT (which will return a Function).
|
166
|
+
if (typeof help === 'string') {
|
167
|
+
help = axe.imports.doT.compile(help);
|
168
|
+
}
|
169
|
+
if (typeof description === 'string') {
|
170
|
+
description = axe.imports.doT.compile(description);
|
171
|
+
}
|
172
|
+
return {
|
173
|
+
...a,
|
174
|
+
help: help || a.help,
|
175
|
+
description: description || a.description
|
176
|
+
};
|
177
|
+
};
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Apply locale for the given `checks`.
|
181
|
+
*/
|
182
|
+
|
183
|
+
Audit.prototype._applyCheckLocale = function(checks) {
|
184
|
+
const keys = Object.keys(checks);
|
185
|
+
for (let i = 0; i < keys.length; i++) {
|
186
|
+
const id = keys[i];
|
187
|
+
if (!this.data.checks[id]) {
|
188
|
+
throw new Error(`Locale provided for unknown check: "${id}"`);
|
189
|
+
}
|
190
|
+
|
191
|
+
this.data.checks[id] = mergeCheckLocale(this.data.checks[id], checks[id]);
|
192
|
+
}
|
193
|
+
};
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Apply locale for the given `rules`.
|
197
|
+
*/
|
198
|
+
|
199
|
+
Audit.prototype._applyRuleLocale = function(rules) {
|
200
|
+
const keys = Object.keys(rules);
|
201
|
+
for (let i = 0; i < keys.length; i++) {
|
202
|
+
const id = keys[i];
|
203
|
+
if (!this.data.rules[id]) {
|
204
|
+
throw new Error(`Locale provided for unknown rule: "${id}"`);
|
205
|
+
}
|
206
|
+
this.data.rules[id] = mergeRuleLocale(this.data.rules[id], rules[id]);
|
207
|
+
}
|
208
|
+
};
|
209
|
+
|
210
|
+
/**
|
211
|
+
* Apply the given `locale`.
|
212
|
+
*
|
213
|
+
* @param {axe.Locale}
|
214
|
+
*/
|
215
|
+
|
216
|
+
Audit.prototype.applyLocale = function(locale) {
|
217
|
+
this._setDefaultLocale();
|
218
|
+
|
219
|
+
if (locale.checks) {
|
220
|
+
this._applyCheckLocale(locale.checks);
|
221
|
+
}
|
222
|
+
|
223
|
+
if (locale.rules) {
|
224
|
+
this._applyRuleLocale(locale.rules);
|
225
|
+
}
|
226
|
+
};
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Initializes the rules and checks
|
230
|
+
*/
|
231
|
+
Audit.prototype._init = function() {
|
232
|
+
var audit = getDefaultConfiguration(this.defaultConfig);
|
233
|
+
|
234
|
+
axe.commons = commons = audit.commons;
|
235
|
+
|
236
|
+
this.reporter = audit.reporter;
|
237
|
+
this.commands = {};
|
238
|
+
this.rules = [];
|
239
|
+
this.checks = {};
|
240
|
+
|
241
|
+
unpackToObject(audit.rules, this, 'addRule');
|
242
|
+
unpackToObject(audit.checks, this, 'addCheck');
|
243
|
+
|
244
|
+
this.data = {};
|
245
|
+
this.data.checks = (audit.data && audit.data.checks) || {};
|
246
|
+
this.data.rules = (audit.data && audit.data.rules) || {};
|
247
|
+
this.data.failureSummaries =
|
248
|
+
(audit.data && audit.data.failureSummaries) || {};
|
249
|
+
this.data.incompleteFallbackMessage =
|
250
|
+
(audit.data && audit.data.incompleteFallbackMessage) || '';
|
251
|
+
|
252
|
+
this._constructHelpUrls(); // create default helpUrls
|
253
|
+
};
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Adds a new command to the audit
|
257
|
+
*/
|
258
|
+
|
259
|
+
Audit.prototype.registerCommand = function(command) {
|
260
|
+
'use strict';
|
261
|
+
this.commands[command.id] = command.callback;
|
262
|
+
};
|
263
|
+
|
264
|
+
/**
|
265
|
+
* Adds a new rule to the Audit. If a rule with specified ID already exists, it will be overridden
|
266
|
+
* @param {Object} spec Rule specification object
|
267
|
+
*/
|
268
|
+
Audit.prototype.addRule = function(spec) {
|
269
|
+
'use strict';
|
270
|
+
|
271
|
+
if (spec.metadata) {
|
272
|
+
this.data.rules[spec.id] = spec.metadata;
|
273
|
+
}
|
274
|
+
|
275
|
+
let rule = this.getRule(spec.id);
|
276
|
+
if (rule) {
|
277
|
+
rule.configure(spec);
|
278
|
+
} else {
|
279
|
+
this.rules.push(new Rule(spec, this));
|
280
|
+
}
|
281
|
+
};
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Adds a new check to the Audit. If a Check with specified ID already exists, it will be
|
285
|
+
* reconfigured
|
286
|
+
*
|
287
|
+
* @param {Object} spec Check specification object
|
288
|
+
*/
|
289
|
+
Audit.prototype.addCheck = function(spec) {
|
290
|
+
/*eslint no-eval: 0 */
|
291
|
+
'use strict';
|
292
|
+
let metadata = spec.metadata;
|
293
|
+
|
294
|
+
if (typeof metadata === 'object') {
|
295
|
+
this.data.checks[spec.id] = metadata;
|
296
|
+
// Transform messages into functions:
|
297
|
+
if (typeof metadata.messages === 'object') {
|
298
|
+
Object.keys(metadata.messages)
|
299
|
+
.filter(
|
300
|
+
prop =>
|
301
|
+
metadata.messages.hasOwnProperty(prop) &&
|
302
|
+
typeof metadata.messages[prop] === 'string'
|
303
|
+
)
|
304
|
+
.forEach(prop => {
|
305
|
+
if (metadata.messages[prop].indexOf('function') === 0) {
|
306
|
+
metadata.messages[prop] = new Function(
|
307
|
+
'return ' + metadata.messages[prop] + ';'
|
308
|
+
)();
|
309
|
+
}
|
310
|
+
});
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
if (this.checks[spec.id]) {
|
315
|
+
this.checks[spec.id].configure(spec);
|
316
|
+
} else {
|
317
|
+
this.checks[spec.id] = new Check(spec);
|
318
|
+
}
|
319
|
+
};
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Splits a given array of rules to two, with rules that can be run immediately and one's that are dependent on preloadedAssets
|
323
|
+
* @method getRulesToRun
|
324
|
+
* @param {Array<Object>} rules complete list of rules
|
325
|
+
* @param {Object} context
|
326
|
+
* @param {Object} options
|
327
|
+
* @return {Object} out, an object containing two arrays, one being list of rules to run now and list of rules to run later
|
328
|
+
* @private
|
329
|
+
*/
|
330
|
+
function getRulesToRun(rules, context, options) {
|
331
|
+
// entry object for reduce function below
|
332
|
+
const base = {
|
333
|
+
now: [],
|
334
|
+
later: []
|
335
|
+
};
|
336
|
+
|
337
|
+
// iterate through rules and separate out rules that need to be run now vs later
|
338
|
+
const splitRules = rules.reduce((out, rule) => {
|
339
|
+
// ensure rule can run
|
340
|
+
if (!axe.utils.ruleShouldRun(rule, context, options)) {
|
341
|
+
return out;
|
342
|
+
}
|
343
|
+
|
344
|
+
// does rule require preload assets - push to later array
|
345
|
+
if (rule.preload) {
|
346
|
+
out.later.push(rule);
|
347
|
+
return out;
|
348
|
+
}
|
349
|
+
|
350
|
+
// default to now array
|
351
|
+
out.now.push(rule);
|
352
|
+
|
353
|
+
// return
|
354
|
+
return out;
|
355
|
+
}, base);
|
356
|
+
|
357
|
+
// return
|
358
|
+
return splitRules;
|
359
|
+
}
|
360
|
+
|
361
|
+
/**
|
362
|
+
* Convenience method, that consturcts a rule `run` function that can be deferred
|
363
|
+
* @param {Object} rule rule to be deferred
|
364
|
+
* @param {Object} context context object essential to be passed into rule `run`
|
365
|
+
* @param {Object} options normalised options to be passed into rule `run`
|
366
|
+
* @param {Object} assets (optional) preloaded assets to be passed into rule and checks (if the rule is preload dependent)
|
367
|
+
* @return {Function} a deferrable function for rule
|
368
|
+
*/
|
369
|
+
function getDefferedRule(rule, context, options) {
|
370
|
+
// init performance timer of requested via options
|
371
|
+
if (options.performanceTimer) {
|
372
|
+
axe.utils.performanceTimer.mark('mark_rule_start_' + rule.id);
|
373
|
+
}
|
374
|
+
|
375
|
+
return (resolve, reject) => {
|
376
|
+
// invoke `rule.run`
|
377
|
+
rule.run(
|
378
|
+
context,
|
379
|
+
options,
|
380
|
+
// resolve callback for rule `run`
|
381
|
+
ruleResult => {
|
382
|
+
// resolve
|
383
|
+
resolve(ruleResult);
|
384
|
+
},
|
385
|
+
// reject callback for rule `run`
|
386
|
+
err => {
|
387
|
+
// if debug - construct error details
|
388
|
+
if (!options.debug) {
|
389
|
+
const errResult = Object.assign(new RuleResult(rule), {
|
390
|
+
result: axe.constants.CANTTELL,
|
391
|
+
description: 'An error occured while running this rule',
|
392
|
+
message: err.message,
|
393
|
+
stack: err.stack,
|
394
|
+
error: err,
|
395
|
+
// Add a serialized reference to the node the rule failed on for easier debugging.
|
396
|
+
// See https://github.com/dequelabs/axe-core/issues/1317.
|
397
|
+
errorNode: err.errorNode
|
398
|
+
});
|
399
|
+
// resolve
|
400
|
+
resolve(errResult);
|
401
|
+
} else {
|
402
|
+
// reject
|
403
|
+
reject(err);
|
404
|
+
}
|
405
|
+
}
|
406
|
+
);
|
407
|
+
};
|
408
|
+
}
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Runs the Audit; which in turn should call `run` on each rule.
|
412
|
+
* @async
|
413
|
+
* @param {Context} context The scope definition/context for analysis (include/exclude)
|
414
|
+
* @param {Object} options Options object to pass into rules and/or disable rules or checks
|
415
|
+
* @param {Function} fn Callback function to fire when audit is complete
|
416
|
+
*/
|
417
|
+
Audit.prototype.run = function(context, options, resolve, reject) {
|
418
|
+
'use strict';
|
419
|
+
|
420
|
+
this.normalizeOptions(options);
|
421
|
+
axe._selectCache = [];
|
422
|
+
|
423
|
+
// get a list of rules to run NOW vs. LATER (later are preload assets dependent rules)
|
424
|
+
const allRulesToRun = getRulesToRun(this.rules, context, options);
|
425
|
+
const runNowRules = allRulesToRun.now;
|
426
|
+
const runLaterRules = allRulesToRun.later;
|
427
|
+
|
428
|
+
// init a NOW queue for rules to run immediately
|
429
|
+
const nowRulesQueue = axe.utils.queue();
|
430
|
+
// construct can run NOW rules into NOW queue
|
431
|
+
runNowRules.forEach(rule => {
|
432
|
+
nowRulesQueue.defer(getDefferedRule(rule, context, options));
|
433
|
+
});
|
434
|
+
|
435
|
+
// init a PRELOADER queue to start preloading assets
|
436
|
+
const preloaderQueue = axe.utils.queue();
|
437
|
+
// defer preload if preload dependent rules exist
|
438
|
+
if (runLaterRules.length) {
|
439
|
+
preloaderQueue.defer((res, rej) => {
|
440
|
+
// handle both success and fail of preload
|
441
|
+
// and resolve, to allow to run all checks
|
442
|
+
axe.utils
|
443
|
+
.preload(options)
|
444
|
+
.then(preloadResults => {
|
445
|
+
// pluck first item in results (because it is a queue - meh!) and resolve
|
446
|
+
const assets = preloadResults[0];
|
447
|
+
res(assets);
|
448
|
+
})
|
449
|
+
.catch(err => {
|
450
|
+
// resolve as undefined, to allow rule.run to continue
|
451
|
+
console.warn(`Couldn't load preload assets: `, err);
|
452
|
+
const assets = undefined;
|
453
|
+
res(assets);
|
454
|
+
});
|
455
|
+
});
|
456
|
+
}
|
457
|
+
|
458
|
+
// defer now and preload queue to run immediately
|
459
|
+
const queueForNowRulesAndPreloader = axe.utils.queue();
|
460
|
+
queueForNowRulesAndPreloader.defer(nowRulesQueue);
|
461
|
+
queueForNowRulesAndPreloader.defer(preloaderQueue);
|
462
|
+
|
463
|
+
// invoke the now queue
|
464
|
+
queueForNowRulesAndPreloader
|
465
|
+
.then(nowRulesAndPreloaderResults => {
|
466
|
+
// interpolate results into separate variables
|
467
|
+
const assetsFromQueue = nowRulesAndPreloaderResults.pop();
|
468
|
+
if (assetsFromQueue && assetsFromQueue.length) {
|
469
|
+
// result is a queue (again), hence the index resolution
|
470
|
+
// assets is either an object of key value pairs of asset type and values
|
471
|
+
// eg: cssom: [stylesheets]
|
472
|
+
// or undefined if preload failed
|
473
|
+
const assets = assetsFromQueue[0];
|
474
|
+
// extend context with preloaded assets
|
475
|
+
if (assets) {
|
476
|
+
context = {
|
477
|
+
...context,
|
478
|
+
...assets
|
479
|
+
};
|
480
|
+
}
|
481
|
+
}
|
482
|
+
|
483
|
+
// the reminder of the results are RuleResults
|
484
|
+
const nowRulesResults = nowRulesAndPreloaderResults[0];
|
485
|
+
|
486
|
+
// if there are no rules to run LATER - resolve with rule results
|
487
|
+
if (!runLaterRules.length) {
|
488
|
+
// remove the cache
|
489
|
+
axe._selectCache = undefined;
|
490
|
+
// resolve
|
491
|
+
resolve(nowRulesResults.filter(result => !!result));
|
492
|
+
return;
|
493
|
+
}
|
494
|
+
|
495
|
+
// init a LATER queue for rules that are dependant on preloaded assets
|
496
|
+
const laterRulesQueue = axe.utils.queue();
|
497
|
+
runLaterRules.forEach(rule => {
|
498
|
+
const deferredRule = getDefferedRule(rule, context, options);
|
499
|
+
laterRulesQueue.defer(deferredRule);
|
500
|
+
});
|
501
|
+
// invoke the later queue
|
502
|
+
laterRulesQueue
|
503
|
+
.then(laterRuleResults => {
|
504
|
+
// remove the cache
|
505
|
+
axe._selectCache = undefined;
|
506
|
+
// resolve
|
507
|
+
resolve(
|
508
|
+
nowRulesResults.concat(laterRuleResults).filter(result => !!result)
|
509
|
+
);
|
510
|
+
})
|
511
|
+
.catch(reject);
|
512
|
+
})
|
513
|
+
.catch(reject);
|
514
|
+
};
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Runs Rule `after` post processing functions
|
518
|
+
* @param {Array} results Array of RuleResults to postprocess
|
519
|
+
* @param {Mixed} options Options object to pass into rules and/or disable rules or checks
|
520
|
+
*/
|
521
|
+
Audit.prototype.after = function(results, options) {
|
522
|
+
'use strict';
|
523
|
+
|
524
|
+
var rules = this.rules;
|
525
|
+
|
526
|
+
return results.map(function(ruleResult) {
|
527
|
+
var rule = axe.utils.findBy(rules, 'id', ruleResult.id);
|
528
|
+
if (!rule) {
|
529
|
+
// If you see this, you're probably running the Mocha tests with the aXe extension installed
|
530
|
+
throw new Error(
|
531
|
+
'Result for unknown rule. You may be running mismatch aXe-core versions'
|
532
|
+
);
|
533
|
+
}
|
534
|
+
|
535
|
+
return rule.after(ruleResult, options);
|
536
|
+
});
|
537
|
+
};
|
538
|
+
|
539
|
+
/**
|
540
|
+
* Get the rule with a given ID
|
541
|
+
* @param {string}
|
542
|
+
* @return {Rule}
|
543
|
+
*/
|
544
|
+
Audit.prototype.getRule = function(ruleId) {
|
545
|
+
return this.rules.find(rule => rule.id === ruleId);
|
546
|
+
};
|
547
|
+
|
548
|
+
/**
|
549
|
+
* Ensure all rules that are expected to run exist
|
550
|
+
* @throws {Error} If any tag or rule specified in options is unknown
|
551
|
+
* @param {Object} options Options object
|
552
|
+
* @return {Object} Validated options object
|
553
|
+
*/
|
554
|
+
Audit.prototype.normalizeOptions = function(options) {
|
555
|
+
/* eslint max-statements: ["error", 22] */
|
556
|
+
'use strict';
|
557
|
+
var audit = this;
|
558
|
+
|
559
|
+
// Validate runOnly
|
560
|
+
if (typeof options.runOnly === 'object') {
|
561
|
+
if (Array.isArray(options.runOnly)) {
|
562
|
+
options.runOnly = {
|
563
|
+
type: 'tag',
|
564
|
+
values: options.runOnly
|
565
|
+
};
|
566
|
+
}
|
567
|
+
const only = options.runOnly;
|
568
|
+
if (only.value && !only.values) {
|
569
|
+
only.values = only.value;
|
570
|
+
delete only.value;
|
571
|
+
}
|
572
|
+
|
573
|
+
if (!Array.isArray(only.values) || only.values.length === 0) {
|
574
|
+
throw new Error('runOnly.values must be a non-empty array');
|
575
|
+
}
|
576
|
+
|
577
|
+
// Check if every value in options.runOnly is a known rule ID
|
578
|
+
if (['rule', 'rules'].includes(only.type)) {
|
579
|
+
only.type = 'rule';
|
580
|
+
only.values.forEach(function(ruleId) {
|
581
|
+
if (!audit.getRule(ruleId)) {
|
582
|
+
throw new Error('unknown rule `' + ruleId + '` in options.runOnly');
|
583
|
+
}
|
584
|
+
});
|
585
|
+
|
586
|
+
// Validate 'tags' (e.g. anything not 'rule')
|
587
|
+
} else if (['tag', 'tags', undefined].includes(only.type)) {
|
588
|
+
only.type = 'tag';
|
589
|
+
const unmatchedTags = audit.rules.reduce((unmatchedTags, rule) => {
|
590
|
+
return unmatchedTags.length
|
591
|
+
? unmatchedTags.filter(tag => !rule.tags.includes(tag))
|
592
|
+
: unmatchedTags;
|
593
|
+
}, only.values);
|
594
|
+
|
595
|
+
if (unmatchedTags.length !== 0) {
|
596
|
+
axe.log('Could not find tags `' + unmatchedTags.join('`, `') + '`');
|
597
|
+
}
|
598
|
+
} else {
|
599
|
+
throw new Error(`Unknown runOnly type '${only.type}'`);
|
600
|
+
}
|
601
|
+
}
|
602
|
+
|
603
|
+
if (typeof options.rules === 'object') {
|
604
|
+
Object.keys(options.rules).forEach(function(ruleId) {
|
605
|
+
if (!audit.getRule(ruleId)) {
|
606
|
+
throw new Error('unknown rule `' + ruleId + '` in options.rules');
|
607
|
+
}
|
608
|
+
});
|
609
|
+
}
|
610
|
+
|
611
|
+
return options;
|
612
|
+
};
|
613
|
+
|
614
|
+
/*
|
615
|
+
* Updates the default options and then applies them
|
616
|
+
* @param {Mixed} options Options object
|
617
|
+
*/
|
618
|
+
|
619
|
+
Audit.prototype.setBranding = function(branding) {
|
620
|
+
'use strict';
|
621
|
+
let previous = {
|
622
|
+
brand: this.brand,
|
623
|
+
application: this.application
|
624
|
+
};
|
625
|
+
if (
|
626
|
+
branding &&
|
627
|
+
branding.hasOwnProperty('brand') &&
|
628
|
+
branding.brand &&
|
629
|
+
typeof branding.brand === 'string'
|
630
|
+
) {
|
631
|
+
this.brand = branding.brand;
|
632
|
+
}
|
633
|
+
if (
|
634
|
+
branding &&
|
635
|
+
branding.hasOwnProperty('application') &&
|
636
|
+
branding.application &&
|
637
|
+
typeof branding.application === 'string'
|
638
|
+
) {
|
639
|
+
this.application = branding.application;
|
640
|
+
}
|
641
|
+
this._constructHelpUrls(previous);
|
642
|
+
};
|
643
|
+
|
644
|
+
/**
|
645
|
+
* For all the rules, create the helpUrl and add it to the data for that rule
|
646
|
+
*/
|
647
|
+
function getHelpUrl({ brand, application }, ruleId, version) {
|
648
|
+
return (
|
649
|
+
axe.constants.helpUrlBase +
|
650
|
+
brand +
|
651
|
+
'/' +
|
652
|
+
(version || axe.version.substring(0, axe.version.lastIndexOf('.'))) +
|
653
|
+
'/' +
|
654
|
+
ruleId +
|
655
|
+
'?application=' +
|
656
|
+
application
|
657
|
+
);
|
658
|
+
}
|
659
|
+
|
660
|
+
Audit.prototype._constructHelpUrls = function(previous = null) {
|
661
|
+
var version = (axe.version.match(/^[1-9][0-9]*\.[0-9]+/) || ['x.y'])[0];
|
662
|
+
this.rules.forEach(rule => {
|
663
|
+
if (!this.data.rules[rule.id]) {
|
664
|
+
this.data.rules[rule.id] = {};
|
665
|
+
}
|
666
|
+
let metaData = this.data.rules[rule.id];
|
667
|
+
if (
|
668
|
+
typeof metaData.helpUrl !== 'string' ||
|
669
|
+
(previous && metaData.helpUrl === getHelpUrl(previous, rule.id, version))
|
670
|
+
) {
|
671
|
+
metaData.helpUrl = getHelpUrl(this, rule.id, version);
|
672
|
+
}
|
673
|
+
});
|
674
|
+
};
|
675
|
+
|
676
|
+
/**
|
677
|
+
* Reset the default rules, checks and meta data
|
678
|
+
*/
|
679
|
+
|
680
|
+
Audit.prototype.resetRulesAndChecks = function() {
|
681
|
+
'use strict';
|
682
|
+
this._init();
|
683
|
+
this._resetLocale();
|
684
|
+
};
|