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,16 @@
|
|
1
|
+
/**
|
2
|
+
* Convenience function to extract primary language subtag from a given value
|
3
|
+
* @method getBaseLang
|
4
|
+
* @memberof axe.utils
|
5
|
+
* @param {String} value value specified as lang or xml:lang attribute
|
6
|
+
* @return {String}
|
7
|
+
*/
|
8
|
+
axe.utils.getBaseLang = function getBaseLang(lang) {
|
9
|
+
if (!lang) {
|
10
|
+
return '';
|
11
|
+
}
|
12
|
+
return lang
|
13
|
+
.trim()
|
14
|
+
.split('-')[0]
|
15
|
+
.toLowerCase();
|
16
|
+
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/*eslint complexity: ["error", 12]*/
|
2
|
+
/**
|
3
|
+
* Determines which CheckOption to use, either defined on the rule options, global check options or the check itself
|
4
|
+
* @param {Check} check The Check object
|
5
|
+
* @param {String} ruleID The ID of the rule
|
6
|
+
* @param {Object} options Options object as passed to main API
|
7
|
+
* @return {Object} The resolved object with `options` and `enabled` keys
|
8
|
+
*/
|
9
|
+
axe.utils.getCheckOption = function(check, ruleID, options) {
|
10
|
+
var ruleCheckOption = (((options.rules && options.rules[ruleID]) || {})
|
11
|
+
.checks || {})[check.id];
|
12
|
+
var checkOption = (options.checks || {})[check.id];
|
13
|
+
|
14
|
+
var enabled = check.enabled;
|
15
|
+
var opts = check.options;
|
16
|
+
|
17
|
+
if (checkOption) {
|
18
|
+
if (checkOption.hasOwnProperty('enabled')) {
|
19
|
+
enabled = checkOption.enabled;
|
20
|
+
}
|
21
|
+
if (checkOption.hasOwnProperty('options')) {
|
22
|
+
opts = checkOption.options;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
if (ruleCheckOption) {
|
27
|
+
if (ruleCheckOption.hasOwnProperty('enabled')) {
|
28
|
+
enabled = ruleCheckOption.enabled;
|
29
|
+
}
|
30
|
+
if (ruleCheckOption.hasOwnProperty('options')) {
|
31
|
+
opts = ruleCheckOption.options;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
return {
|
36
|
+
enabled: enabled,
|
37
|
+
options: opts,
|
38
|
+
absolutePaths: options.absolutePaths
|
39
|
+
};
|
40
|
+
};
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/* eslint max-statements:["error",18], complexity:["error",27], no-script-url:0 */
|
2
|
+
/**
|
3
|
+
* Check if a string contains mostly numbers
|
4
|
+
*/
|
5
|
+
function isMostlyNumbers(str = '') {
|
6
|
+
return (
|
7
|
+
str.length !== 0 && (str.match(/[0-9]/g) || '').length >= str.length / 2
|
8
|
+
);
|
9
|
+
}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Spit a string into an array with two pieces, at a given index
|
13
|
+
* @param String string to split
|
14
|
+
* @param Number index at which to split
|
15
|
+
* @return Array
|
16
|
+
*/
|
17
|
+
function splitString(str, splitIndex) {
|
18
|
+
return [str.substring(0, splitIndex), str.substring(splitIndex)];
|
19
|
+
}
|
20
|
+
|
21
|
+
function trimRight(str) {
|
22
|
+
return str.replace(/\s+$/, '');
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Take a relative or absolute URL and pull it into it's indivisual pieces
|
27
|
+
*
|
28
|
+
* @param url (string)
|
29
|
+
* @return urlPieces
|
30
|
+
* .protocol The protocol used, e.g. 'https://'
|
31
|
+
* .domain Domain name including sub domains and TLD, e.g. 'docs.deque.com'
|
32
|
+
* .port The port number, e.g. ':8080'
|
33
|
+
* .path Path after the domain, e.g. '/home.html'
|
34
|
+
* .query Query string, e.g. '?user=admin&password=pass'
|
35
|
+
* .hash Hash / internal reference, e.g. '#footer'
|
36
|
+
*/
|
37
|
+
function uriParser(url) {
|
38
|
+
let original = url;
|
39
|
+
let protocol = '',
|
40
|
+
domain = '',
|
41
|
+
port = '',
|
42
|
+
path = '',
|
43
|
+
query = '',
|
44
|
+
hash = '';
|
45
|
+
if (url.includes('#')) {
|
46
|
+
[url, hash] = splitString(url, url.indexOf('#'));
|
47
|
+
}
|
48
|
+
|
49
|
+
if (url.includes('?')) {
|
50
|
+
[url, query] = splitString(url, url.indexOf('?'));
|
51
|
+
}
|
52
|
+
|
53
|
+
if (url.includes('://')) {
|
54
|
+
[protocol, url] = url.split('://');
|
55
|
+
[domain, url] = splitString(url, url.indexOf('/'));
|
56
|
+
} else if (url.substr(0, 2) === '//') {
|
57
|
+
url = url.substr(2);
|
58
|
+
[domain, url] = splitString(url, url.indexOf('/'));
|
59
|
+
}
|
60
|
+
|
61
|
+
if (domain.substr(0, 4) === 'www.') {
|
62
|
+
domain = domain.substr(4);
|
63
|
+
}
|
64
|
+
|
65
|
+
if (domain && domain.includes(':')) {
|
66
|
+
[domain, port] = splitString(domain, domain.indexOf(':'));
|
67
|
+
}
|
68
|
+
|
69
|
+
path = url; // Whatever is left, must be the path
|
70
|
+
return { original, protocol, domain, port, path, query, hash };
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Try to, at the end of the URI, find a string that a user can identify the URI by
|
75
|
+
*
|
76
|
+
* @param uri The URI to use
|
77
|
+
* @param options
|
78
|
+
* .currentDomain The current domain name (optional)
|
79
|
+
* .maxLength Max length of the returned string (default: 25)
|
80
|
+
* @return string A portion at the end of the uri, no longer than maxLength
|
81
|
+
*/
|
82
|
+
axe.utils.getFriendlyUriEnd = function getFriendlyUriEnd(
|
83
|
+
uri = '',
|
84
|
+
options = {}
|
85
|
+
) {
|
86
|
+
if (
|
87
|
+
// Skip certain URIs:
|
88
|
+
uri.length <= 1 || // very short
|
89
|
+
uri.substr(0, 5) === 'data:' || // data URIs are unreadable
|
90
|
+
uri.substr(0, 11) === 'javascript:' || // JS isn't a URL
|
91
|
+
uri.includes('?') // query strings aren't very readable either
|
92
|
+
) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
|
96
|
+
const { currentDomain, maxLength = 25 } = options;
|
97
|
+
const { path, domain, hash } = uriParser(uri);
|
98
|
+
// Split the path at the last / that has text after it
|
99
|
+
const pathEnd = path.substr(
|
100
|
+
path.substr(0, path.length - 2).lastIndexOf('/') + 1
|
101
|
+
);
|
102
|
+
|
103
|
+
if (hash) {
|
104
|
+
if (pathEnd && (pathEnd + hash).length <= maxLength) {
|
105
|
+
return trimRight(pathEnd + hash);
|
106
|
+
} else if (
|
107
|
+
pathEnd.length < 2 &&
|
108
|
+
hash.length > 2 &&
|
109
|
+
hash.length <= maxLength
|
110
|
+
) {
|
111
|
+
return trimRight(hash);
|
112
|
+
} else {
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
} else if (domain && domain.length < maxLength && path.length <= 1) {
|
116
|
+
// '' or '/'
|
117
|
+
return trimRight(domain + path);
|
118
|
+
}
|
119
|
+
|
120
|
+
// See if the domain should be returned
|
121
|
+
if (
|
122
|
+
path === '/' + pathEnd &&
|
123
|
+
domain &&
|
124
|
+
currentDomain &&
|
125
|
+
domain !== currentDomain &&
|
126
|
+
(domain + path).length <= maxLength
|
127
|
+
) {
|
128
|
+
return trimRight(domain + path);
|
129
|
+
}
|
130
|
+
|
131
|
+
const lastDotIndex = pathEnd.lastIndexOf('.');
|
132
|
+
if (
|
133
|
+
// Exclude very short or very long string
|
134
|
+
(lastDotIndex === -1 || lastDotIndex > 1) &&
|
135
|
+
(lastDotIndex !== -1 || pathEnd.length > 2) &&
|
136
|
+
pathEnd.length <= maxLength &&
|
137
|
+
// Exclude index files
|
138
|
+
!pathEnd.match(/index(\.[a-zA-Z]{2-4})?/) &&
|
139
|
+
// Exclude files that are likely to be database IDs
|
140
|
+
!isMostlyNumbers(pathEnd)
|
141
|
+
) {
|
142
|
+
return trimRight(pathEnd);
|
143
|
+
}
|
144
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/* global axe */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Return the document or document fragment (shadow DOM)
|
5
|
+
* @method getRootNode
|
6
|
+
* @memberof axe.utils
|
7
|
+
* @param {Element} node
|
8
|
+
* @returns {DocumentFragment|Document}
|
9
|
+
*/
|
10
|
+
axe.utils.getRootNode = function getRootNode(node) {
|
11
|
+
var doc = (node.getRootNode && node.getRootNode()) || document; // this is for backwards compatibility
|
12
|
+
if (doc === node) {
|
13
|
+
// disconnected node
|
14
|
+
doc = document;
|
15
|
+
}
|
16
|
+
return doc;
|
17
|
+
};
|
@@ -0,0 +1,406 @@
|
|
1
|
+
const escapeSelector = axe.utils.escapeSelector;
|
2
|
+
let isXHTML;
|
3
|
+
const ignoredAttributes = [
|
4
|
+
'class',
|
5
|
+
'style',
|
6
|
+
'id',
|
7
|
+
'selected',
|
8
|
+
'checked',
|
9
|
+
'disabled',
|
10
|
+
'tabindex',
|
11
|
+
'aria-checked',
|
12
|
+
'aria-selected',
|
13
|
+
'aria-invalid',
|
14
|
+
'aria-activedescendant',
|
15
|
+
'aria-busy',
|
16
|
+
'aria-disabled',
|
17
|
+
'aria-expanded',
|
18
|
+
'aria-grabbed',
|
19
|
+
'aria-pressed',
|
20
|
+
'aria-valuenow'
|
21
|
+
];
|
22
|
+
const MAXATTRIBUTELENGTH = 31;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* get the attribute name and value as a string
|
26
|
+
* @param {Element} node The element that has the attribute
|
27
|
+
* @param {Attribute} at The attribute
|
28
|
+
* @return {String}
|
29
|
+
*/
|
30
|
+
function getAttributeNameValue(node, at) {
|
31
|
+
const name = at.name;
|
32
|
+
let atnv;
|
33
|
+
|
34
|
+
if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) {
|
35
|
+
let friendly = axe.utils.getFriendlyUriEnd(node.getAttribute(name));
|
36
|
+
if (friendly) {
|
37
|
+
let value = encodeURI(friendly);
|
38
|
+
if (value) {
|
39
|
+
atnv = escapeSelector(at.name) + '$="' + escapeSelector(value) + '"';
|
40
|
+
} else {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
} else {
|
44
|
+
atnv =
|
45
|
+
escapeSelector(at.name) +
|
46
|
+
'="' +
|
47
|
+
escapeSelector(node.getAttribute(name)) +
|
48
|
+
'"';
|
49
|
+
}
|
50
|
+
} else {
|
51
|
+
atnv = escapeSelector(name) + '="' + escapeSelector(at.value) + '"';
|
52
|
+
}
|
53
|
+
return atnv;
|
54
|
+
}
|
55
|
+
|
56
|
+
function countSort(a, b) {
|
57
|
+
return a.count < b.count ? -1 : a.count === b.count ? 0 : 1;
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Filter the attributes
|
62
|
+
* @param {Attribute} The potential attribute
|
63
|
+
* @return {Boolean} Whether to include or exclude
|
64
|
+
*/
|
65
|
+
function filterAttributes(at) {
|
66
|
+
return (
|
67
|
+
!ignoredAttributes.includes(at.name) &&
|
68
|
+
at.name.indexOf(':') === -1 &&
|
69
|
+
(!at.value || at.value.length < MAXATTRIBUTELENGTH)
|
70
|
+
);
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Calculate the statistics for the classes, attributes and tags on the page, using
|
75
|
+
* the virtual DOM tree
|
76
|
+
* @param {Object} domTree The root node of the virtual DOM tree
|
77
|
+
* @returns {Object} The statistics consisting of three maps, one for classes,
|
78
|
+
* one for tags and one for attributes. The map values are
|
79
|
+
* the counts for how many elements with that feature exist
|
80
|
+
*/
|
81
|
+
axe.utils.getSelectorData = function(domTree) {
|
82
|
+
/* eslint max-statements:["error", 22], no-loop-func:0*/
|
83
|
+
|
84
|
+
// Initialize the return structure with the three maps
|
85
|
+
let data = {
|
86
|
+
classes: {},
|
87
|
+
tags: {},
|
88
|
+
attributes: {}
|
89
|
+
};
|
90
|
+
|
91
|
+
domTree = Array.isArray(domTree) ? domTree : [domTree];
|
92
|
+
let currentLevel = domTree.slice();
|
93
|
+
let stack = [];
|
94
|
+
while (currentLevel.length) {
|
95
|
+
let current = currentLevel.pop();
|
96
|
+
let node = current.actualNode;
|
97
|
+
|
98
|
+
if (!!node.querySelectorAll) {
|
99
|
+
// ignore #text nodes
|
100
|
+
|
101
|
+
// count the tag
|
102
|
+
let tag = node.nodeName;
|
103
|
+
if (data.tags[tag]) {
|
104
|
+
data.tags[tag]++;
|
105
|
+
} else {
|
106
|
+
data.tags[tag] = 1;
|
107
|
+
}
|
108
|
+
|
109
|
+
// count all the classes
|
110
|
+
if (node.classList) {
|
111
|
+
Array.from(node.classList).forEach(cl => {
|
112
|
+
const ind = escapeSelector(cl);
|
113
|
+
if (data.classes[ind]) {
|
114
|
+
data.classes[ind]++;
|
115
|
+
} else {
|
116
|
+
data.classes[ind] = 1;
|
117
|
+
}
|
118
|
+
});
|
119
|
+
}
|
120
|
+
|
121
|
+
// count all the filtered attributes
|
122
|
+
if (node.attributes) {
|
123
|
+
Array.from(node.attributes)
|
124
|
+
.filter(filterAttributes)
|
125
|
+
.forEach(at => {
|
126
|
+
let atnv = getAttributeNameValue(node, at);
|
127
|
+
if (atnv) {
|
128
|
+
if (data.attributes[atnv]) {
|
129
|
+
data.attributes[atnv]++;
|
130
|
+
} else {
|
131
|
+
data.attributes[atnv] = 1;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
}
|
137
|
+
if (current.children.length) {
|
138
|
+
// "recurse"
|
139
|
+
stack.push(currentLevel);
|
140
|
+
currentLevel = current.children.slice();
|
141
|
+
}
|
142
|
+
while (!currentLevel.length && stack.length) {
|
143
|
+
currentLevel = stack.pop();
|
144
|
+
}
|
145
|
+
}
|
146
|
+
return data;
|
147
|
+
};
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Given a node and the statistics on class frequency on the page,
|
151
|
+
* return all its uncommon class data sorted in order of decreasing uniqueness
|
152
|
+
* @param {Element} node The node
|
153
|
+
* @param {Object} classData The map of classes to counts
|
154
|
+
* @return {Array} The sorted array of uncommon class data
|
155
|
+
*/
|
156
|
+
function uncommonClasses(node, selectorData) {
|
157
|
+
// eslint no-loop-func:false
|
158
|
+
let retVal = [];
|
159
|
+
let classData = selectorData.classes;
|
160
|
+
let tagData = selectorData.tags;
|
161
|
+
|
162
|
+
if (node.classList) {
|
163
|
+
Array.from(node.classList).forEach(cl => {
|
164
|
+
let ind = escapeSelector(cl);
|
165
|
+
if (classData[ind] < tagData[node.nodeName]) {
|
166
|
+
retVal.push({
|
167
|
+
name: ind,
|
168
|
+
count: classData[ind],
|
169
|
+
species: 'class'
|
170
|
+
});
|
171
|
+
}
|
172
|
+
});
|
173
|
+
}
|
174
|
+
return retVal.sort(countSort);
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Given an element and a selector that finds that element (but possibly other sibling elements)
|
179
|
+
* return the :nth-child(n) pseudo selector that uniquely finds the node within its siblings
|
180
|
+
* @param {Element} elm The Element
|
181
|
+
* @param {String} selector The selector
|
182
|
+
* @return {String} The nth-child selector
|
183
|
+
*/
|
184
|
+
function getNthChildString(elm, selector) {
|
185
|
+
const siblings =
|
186
|
+
(elm.parentNode && Array.from(elm.parentNode.children || '')) || [];
|
187
|
+
const hasMatchingSiblings = siblings.find(
|
188
|
+
sibling => sibling !== elm && axe.utils.matchesSelector(sibling, selector)
|
189
|
+
);
|
190
|
+
if (hasMatchingSiblings) {
|
191
|
+
const nthChild = 1 + siblings.indexOf(elm);
|
192
|
+
return ':nth-child(' + nthChild + ')';
|
193
|
+
} else {
|
194
|
+
return '';
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Get ID selector
|
200
|
+
*/
|
201
|
+
function getElmId(elm) {
|
202
|
+
if (!elm.getAttribute('id')) {
|
203
|
+
return;
|
204
|
+
}
|
205
|
+
let doc = (elm.getRootNode && elm.getRootNode()) || document;
|
206
|
+
const id = '#' + escapeSelector(elm.getAttribute('id') || '');
|
207
|
+
if (
|
208
|
+
// Don't include youtube's uid values, they change on reload
|
209
|
+
!id.match(/player_uid_/) &&
|
210
|
+
// Don't include IDs that occur more then once on the page
|
211
|
+
doc.querySelectorAll(id).length === 1
|
212
|
+
) {
|
213
|
+
return id;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Return the base CSS selector for a given element
|
219
|
+
* @param {HTMLElement} elm The element to get the selector for
|
220
|
+
* @return {String|Array<String>} Base CSS selector for the node
|
221
|
+
*/
|
222
|
+
function getBaseSelector(elm) {
|
223
|
+
if (typeof isXHTML === 'undefined') {
|
224
|
+
isXHTML = axe.utils.isXHTML(document);
|
225
|
+
}
|
226
|
+
return escapeSelector(isXHTML ? elm.localName : elm.nodeName.toLowerCase());
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Given a node and the statistics on attribute frequency on the page,
|
231
|
+
* return all its uncommon attribute data sorted in order of decreasing uniqueness
|
232
|
+
* @param {Element} node The node
|
233
|
+
* @param {Object} attData The map of attributes to counts
|
234
|
+
* @return {Array} The sorted array of uncommon attribute data
|
235
|
+
*/
|
236
|
+
function uncommonAttributes(node, selectorData) {
|
237
|
+
let retVal = [];
|
238
|
+
let attData = selectorData.attributes;
|
239
|
+
let tagData = selectorData.tags;
|
240
|
+
|
241
|
+
if (node.attributes) {
|
242
|
+
Array.from(node.attributes)
|
243
|
+
.filter(filterAttributes)
|
244
|
+
.forEach(at => {
|
245
|
+
const atnv = getAttributeNameValue(node, at);
|
246
|
+
|
247
|
+
if (atnv && attData[atnv] < tagData[node.nodeName]) {
|
248
|
+
retVal.push({
|
249
|
+
name: atnv,
|
250
|
+
count: attData[atnv],
|
251
|
+
species: 'attribute'
|
252
|
+
});
|
253
|
+
}
|
254
|
+
});
|
255
|
+
}
|
256
|
+
return retVal.sort(countSort);
|
257
|
+
}
|
258
|
+
|
259
|
+
/**
|
260
|
+
* generates a selector fragment for an element based on the statistics of the page in
|
261
|
+
* which the element exists. This function takes into account the fact that selectors that
|
262
|
+
* use classes and tags are much faster than universal selectors. It also tries to use a
|
263
|
+
* unique class selector before a unique attribute selector (with the tag), followed by
|
264
|
+
* a selector made up of the three least common features statistically. A feature will
|
265
|
+
* also only be used if it is less common than the tag of the element itself.
|
266
|
+
*
|
267
|
+
* @param {Element} elm The element for which to generate a selector
|
268
|
+
* @param {Object} options Options for how to generate the selector
|
269
|
+
* @param {RootNode} doc The root node of the document or document fragment
|
270
|
+
* @returns {String} The selector
|
271
|
+
*/
|
272
|
+
|
273
|
+
function getThreeLeastCommonFeatures(elm, selectorData) {
|
274
|
+
let selector = '';
|
275
|
+
let features;
|
276
|
+
let clss = uncommonClasses(elm, selectorData);
|
277
|
+
let atts = uncommonAttributes(elm, selectorData);
|
278
|
+
|
279
|
+
if (clss.length && clss[0].count === 1) {
|
280
|
+
// only use the unique class
|
281
|
+
features = [clss[0]];
|
282
|
+
} else if (atts.length && atts[0].count === 1) {
|
283
|
+
// only use the unique attribute value
|
284
|
+
features = [atts[0]];
|
285
|
+
// if no class, add the tag
|
286
|
+
selector = getBaseSelector(elm);
|
287
|
+
} else {
|
288
|
+
features = clss.concat(atts);
|
289
|
+
// sort by least common
|
290
|
+
features.sort(countSort);
|
291
|
+
|
292
|
+
// select three least common features
|
293
|
+
features = features.slice(0, 3);
|
294
|
+
|
295
|
+
// if no class, add the tag
|
296
|
+
if (
|
297
|
+
!features.some(feat => {
|
298
|
+
return feat.species === 'class';
|
299
|
+
})
|
300
|
+
) {
|
301
|
+
// has no class
|
302
|
+
selector = getBaseSelector(elm);
|
303
|
+
} else {
|
304
|
+
// put the classes at the front of the selector
|
305
|
+
features.sort((a, b) => {
|
306
|
+
return a.species !== b.species && a.species === 'class'
|
307
|
+
? -1
|
308
|
+
: a.species === b.species
|
309
|
+
? 0
|
310
|
+
: 1;
|
311
|
+
});
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
// construct the return value
|
316
|
+
return (selector += features.reduce((val, feat) => {
|
317
|
+
/*eslint indent: 0*/
|
318
|
+
switch (feat.species) {
|
319
|
+
case 'class':
|
320
|
+
return val + '.' + feat.name;
|
321
|
+
case 'attribute':
|
322
|
+
return val + '[' + feat.name + ']';
|
323
|
+
}
|
324
|
+
return val; // should never happen
|
325
|
+
}, ''));
|
326
|
+
}
|
327
|
+
|
328
|
+
/**
|
329
|
+
* generates a single selector for an element
|
330
|
+
* @param {Element} elm The element for which to generate a selector
|
331
|
+
* @param {Object} options Options for how to generate the selector
|
332
|
+
* @param {RootNode} doc The root node of the document or document fragment
|
333
|
+
* @returns {String} The selector
|
334
|
+
*/
|
335
|
+
|
336
|
+
function generateSelector(elm, options, doc) {
|
337
|
+
/*eslint max-statements:["error", 22], no-loop-func:0*/
|
338
|
+
if (!axe._selectorData) {
|
339
|
+
throw new Error('Expect axe._selectorData to be set up');
|
340
|
+
}
|
341
|
+
const { toRoot = false } = options;
|
342
|
+
let selector;
|
343
|
+
let similar;
|
344
|
+
|
345
|
+
/**
|
346
|
+
* Try to find a unique selector by filtering out all the clashing
|
347
|
+
* nodes by adding ancestor selectors iteratively.
|
348
|
+
* This loop is much faster than recursing and using querySelectorAll
|
349
|
+
*/
|
350
|
+
do {
|
351
|
+
let features = getElmId(elm);
|
352
|
+
if (!features) {
|
353
|
+
features = getThreeLeastCommonFeatures(elm, axe._selectorData);
|
354
|
+
features += getNthChildString(elm, features);
|
355
|
+
}
|
356
|
+
if (selector) {
|
357
|
+
selector = features + ' > ' + selector;
|
358
|
+
} else {
|
359
|
+
selector = features;
|
360
|
+
}
|
361
|
+
if (!similar) {
|
362
|
+
similar = Array.from(doc.querySelectorAll(selector));
|
363
|
+
} else {
|
364
|
+
similar = similar.filter(item => {
|
365
|
+
return axe.utils.matchesSelector(item, selector);
|
366
|
+
});
|
367
|
+
}
|
368
|
+
elm = elm.parentElement;
|
369
|
+
} while ((similar.length > 1 || toRoot) && elm && elm.nodeType !== 11);
|
370
|
+
|
371
|
+
if (similar.length === 1) {
|
372
|
+
return selector;
|
373
|
+
} else if (selector.indexOf(' > ') !== -1) {
|
374
|
+
// For the odd case that document doesn't have a unique selector
|
375
|
+
return ':root' + selector.substring(selector.indexOf(' > '));
|
376
|
+
}
|
377
|
+
return ':root';
|
378
|
+
}
|
379
|
+
|
380
|
+
/**
|
381
|
+
* Gets a unique CSS selector
|
382
|
+
* @param {HTMLElement} node The element to get the selector for
|
383
|
+
* @param {Object} optional options
|
384
|
+
* @returns {String|Array<String>} Unique CSS selector for the node
|
385
|
+
*/
|
386
|
+
axe.utils.getSelector = function createUniqueSelector(elm, options = {}) {
|
387
|
+
if (!elm) {
|
388
|
+
return '';
|
389
|
+
}
|
390
|
+
let doc = (elm.getRootNode && elm.getRootNode()) || document;
|
391
|
+
if (doc.nodeType === 11) {
|
392
|
+
// DOCUMENT_FRAGMENT
|
393
|
+
let stack = [];
|
394
|
+
while (doc.nodeType === 11) {
|
395
|
+
stack.push({ elm: elm, doc: doc });
|
396
|
+
elm = doc.host;
|
397
|
+
doc = elm.getRootNode();
|
398
|
+
}
|
399
|
+
stack.push({ elm: elm, doc: doc });
|
400
|
+
return stack.reverse().map(comp => {
|
401
|
+
return generateSelector(comp.elm, options, comp.doc);
|
402
|
+
});
|
403
|
+
} else {
|
404
|
+
return generateSelector(elm, options, doc);
|
405
|
+
}
|
406
|
+
};
|