govuk_publishing_components 16.6.0 → 16.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/component_guide/accessibility-test.js +6 -12
- data/app/assets/javascripts/component_guide/vendor/bind-polyfill.js +8 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +16 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss +1 -27
- data/app/views/govuk_publishing_components/components/_fieldset.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_input.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/docs/input.yml +7 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +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
- data/node_modules/govuk-frontend/all.js +19 -14
- data/node_modules/govuk-frontend/components/error-summary/error-summary.js +1 -3
- data/node_modules/govuk-frontend/components/summary-list/macro-options.json +12 -6
- data/node_modules/govuk-frontend/components/summary-list/template.njk +1 -1
- data/node_modules/govuk-frontend/components/tabs/_tabs.scss +1 -1
- data/node_modules/govuk-frontend/helpers/_typography.scss +3 -2
- data/node_modules/govuk-frontend/objects/_main-wrapper.scss +10 -2
- data/node_modules/govuk-frontend/package.json +10 -10
- data/node_modules/govuk-frontend/settings/_typography-font.scss +12 -0
- metadata +513 -3
- data/app/assets/javascripts/component_guide/vendor/axe.min.js +0 -41
@@ -0,0 +1,138 @@
|
|
1
|
+
(function() {
|
2
|
+
'use strict';
|
3
|
+
function noop() {}
|
4
|
+
function funcGuard(f) {
|
5
|
+
if (typeof f !== 'function') {
|
6
|
+
throw new TypeError('Queue methods require functions as arguments');
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Create an asynchronous "queue", list of functions to be invoked in parallel, but not necessarily returned in order
|
12
|
+
* @return {Queue} The newly generated "queue"
|
13
|
+
*/
|
14
|
+
function queue() {
|
15
|
+
var tasks = [];
|
16
|
+
var started = 0;
|
17
|
+
var remaining = 0; // number of tasks not yet finished
|
18
|
+
var completeQueue = noop;
|
19
|
+
var complete = false;
|
20
|
+
var err;
|
21
|
+
|
22
|
+
// By default, wait until the next tick,
|
23
|
+
// if no catch was set, throw to console.
|
24
|
+
var defaultFail = function(e) {
|
25
|
+
err = e;
|
26
|
+
setTimeout(function() {
|
27
|
+
if (err !== undefined && err !== null) {
|
28
|
+
axe.log('Uncaught error (of queue)', err);
|
29
|
+
}
|
30
|
+
}, 1);
|
31
|
+
};
|
32
|
+
var failed = defaultFail;
|
33
|
+
|
34
|
+
function createResolve(i) {
|
35
|
+
return function(r) {
|
36
|
+
tasks[i] = r;
|
37
|
+
remaining -= 1;
|
38
|
+
if (!remaining && completeQueue !== noop) {
|
39
|
+
complete = true;
|
40
|
+
completeQueue(tasks);
|
41
|
+
}
|
42
|
+
};
|
43
|
+
}
|
44
|
+
|
45
|
+
function abort(msg) {
|
46
|
+
// reset tasks
|
47
|
+
completeQueue = noop;
|
48
|
+
|
49
|
+
// notify catch
|
50
|
+
failed(msg);
|
51
|
+
// return unfinished work
|
52
|
+
return tasks;
|
53
|
+
}
|
54
|
+
|
55
|
+
function pop() {
|
56
|
+
var length = tasks.length;
|
57
|
+
for (; started < length; started++) {
|
58
|
+
var task = tasks[started];
|
59
|
+
|
60
|
+
try {
|
61
|
+
task.call(null, createResolve(started), abort);
|
62
|
+
} catch (e) {
|
63
|
+
abort(e);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
var q = {
|
69
|
+
/**
|
70
|
+
* Defer a function that may or may not run asynchronously.
|
71
|
+
*
|
72
|
+
* First parameter should be the function to execute with subsequent
|
73
|
+
* parameters being passed as arguments to that function
|
74
|
+
*/
|
75
|
+
defer: function(fn) {
|
76
|
+
if (typeof fn === 'object' && fn.then && fn.catch) {
|
77
|
+
var defer = fn;
|
78
|
+
fn = function(resolve, reject) {
|
79
|
+
defer.then(resolve).catch(reject);
|
80
|
+
};
|
81
|
+
}
|
82
|
+
funcGuard(fn);
|
83
|
+
if (err !== undefined) {
|
84
|
+
return;
|
85
|
+
} else if (complete) {
|
86
|
+
throw new Error('Queue already completed');
|
87
|
+
}
|
88
|
+
|
89
|
+
tasks.push(fn);
|
90
|
+
++remaining;
|
91
|
+
pop();
|
92
|
+
return q;
|
93
|
+
},
|
94
|
+
|
95
|
+
/**
|
96
|
+
* The callback to execute once all "deferred" functions have completed. Will only be invoked once.
|
97
|
+
* @param {Function} f The callback, receives an array of the return/callbacked
|
98
|
+
* values of each of the "deferred" functions
|
99
|
+
*/
|
100
|
+
then: function(fn) {
|
101
|
+
funcGuard(fn);
|
102
|
+
if (completeQueue !== noop) {
|
103
|
+
throw new Error('queue `then` already set');
|
104
|
+
}
|
105
|
+
if (!err) {
|
106
|
+
completeQueue = fn;
|
107
|
+
if (!remaining) {
|
108
|
+
complete = true;
|
109
|
+
completeQueue(tasks);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
return q;
|
113
|
+
},
|
114
|
+
|
115
|
+
catch: function(fn) {
|
116
|
+
funcGuard(fn);
|
117
|
+
if (failed !== defaultFail) {
|
118
|
+
throw new Error('queue `catch` already set');
|
119
|
+
}
|
120
|
+
if (!err) {
|
121
|
+
failed = fn;
|
122
|
+
} else {
|
123
|
+
fn(err);
|
124
|
+
err = null;
|
125
|
+
}
|
126
|
+
return q;
|
127
|
+
},
|
128
|
+
/**
|
129
|
+
* Abort the "queue" and prevent `then` function from firing
|
130
|
+
* @param {Function} fn The callback to execute; receives an array of the results which have completed
|
131
|
+
*/
|
132
|
+
abort: abort
|
133
|
+
};
|
134
|
+
return q;
|
135
|
+
}
|
136
|
+
|
137
|
+
axe.utils.queue = queue;
|
138
|
+
})();
|
@@ -0,0 +1,243 @@
|
|
1
|
+
/*global uuid, utils, axe */
|
2
|
+
(function(exports) {
|
3
|
+
'use strict';
|
4
|
+
var messages = {},
|
5
|
+
subscribers = {},
|
6
|
+
errorTypes = Object.freeze([
|
7
|
+
'EvalError',
|
8
|
+
'RangeError',
|
9
|
+
'ReferenceError',
|
10
|
+
'SyntaxError',
|
11
|
+
'TypeError',
|
12
|
+
'URIError'
|
13
|
+
]);
|
14
|
+
|
15
|
+
/**
|
16
|
+
* get the unique string to be used to identify our instance of aXe
|
17
|
+
* @private
|
18
|
+
*/
|
19
|
+
function _getSource() {
|
20
|
+
var application = 'axeAPI',
|
21
|
+
version = '',
|
22
|
+
src;
|
23
|
+
if (typeof axe !== 'undefined' && axe._audit && axe._audit.application) {
|
24
|
+
application = axe._audit.application;
|
25
|
+
}
|
26
|
+
if (typeof axe !== 'undefined') {
|
27
|
+
version = axe.version;
|
28
|
+
}
|
29
|
+
src = application + '.' + version;
|
30
|
+
return src;
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* Verify the received message is from the "respondable" module
|
34
|
+
* @private
|
35
|
+
* @param {Object} postedMessage The message received via postMessage
|
36
|
+
* @return {Boolean} `true` if the message is verified from respondable
|
37
|
+
*/
|
38
|
+
function verify(postedMessage) {
|
39
|
+
if (
|
40
|
+
// Check incoming message is valid
|
41
|
+
typeof postedMessage === 'object' &&
|
42
|
+
typeof postedMessage.uuid === 'string' &&
|
43
|
+
postedMessage._respondable === true
|
44
|
+
) {
|
45
|
+
var messageSource = _getSource();
|
46
|
+
return (
|
47
|
+
// Check the version matches
|
48
|
+
postedMessage._source === messageSource ||
|
49
|
+
// Allow free communication with axe test
|
50
|
+
postedMessage._source === 'axeAPI.x.y.z' ||
|
51
|
+
messageSource === 'axeAPI.x.y.z'
|
52
|
+
);
|
53
|
+
}
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Posts the message to correct frame.
|
59
|
+
* This abstraction necessary because IE9 & 10 do not support posting Objects; only strings
|
60
|
+
* @private
|
61
|
+
* @param {Window} win The `window` to post the message to
|
62
|
+
* @param {String} topic The topic of the message
|
63
|
+
* @param {Object} message The message content
|
64
|
+
* @param {String} uuid The UUID, or pseudo-unique ID of the message
|
65
|
+
* @param {Boolean} keepalive Whether to allow multiple responses - default is false
|
66
|
+
* @param {Function} callback The function to invoke when/if the message is responded to
|
67
|
+
*/
|
68
|
+
function post(win, topic, message, uuid, keepalive, callback) {
|
69
|
+
var error;
|
70
|
+
if (message instanceof Error) {
|
71
|
+
error = {
|
72
|
+
name: message.name,
|
73
|
+
message: message.message,
|
74
|
+
stack: message.stack
|
75
|
+
};
|
76
|
+
message = undefined;
|
77
|
+
}
|
78
|
+
|
79
|
+
var data = {
|
80
|
+
uuid: uuid,
|
81
|
+
topic: topic,
|
82
|
+
message: message,
|
83
|
+
error: error,
|
84
|
+
_respondable: true,
|
85
|
+
_source: _getSource(),
|
86
|
+
_keepalive: keepalive
|
87
|
+
};
|
88
|
+
|
89
|
+
if (typeof callback === 'function') {
|
90
|
+
messages[uuid] = callback;
|
91
|
+
}
|
92
|
+
|
93
|
+
win.postMessage(JSON.stringify(data), '*');
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Post a message to a window who may or may not respond to it.
|
98
|
+
* @param {Window} win The window to post the message to
|
99
|
+
* @param {String} topic The topic of the message
|
100
|
+
* @param {Object} message The message content
|
101
|
+
* @param {Boolean} keepalive Whether to allow multiple responses - default is false
|
102
|
+
* @param {Function} callback The function to invoke when/if the message is responded to
|
103
|
+
*/
|
104
|
+
function respondable(win, topic, message, keepalive, callback) {
|
105
|
+
var id = uuid.v1();
|
106
|
+
post(win, topic, message, id, keepalive, callback);
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Subscribe to messages sent via the `respondable` module.
|
111
|
+
*
|
112
|
+
* Axe._load uses this to listen for messages from other frames
|
113
|
+
*
|
114
|
+
* @param {String} topic The topic to listen to
|
115
|
+
* @param {Function} callback The function to invoke when a message is received
|
116
|
+
*/
|
117
|
+
respondable.subscribe = function(topic, callback) {
|
118
|
+
subscribers[topic] = callback;
|
119
|
+
};
|
120
|
+
|
121
|
+
/**
|
122
|
+
* checks if the current context is inside a frame
|
123
|
+
* @return {Boolean}
|
124
|
+
*/
|
125
|
+
respondable.isInFrame = function(win) {
|
126
|
+
win = win || window;
|
127
|
+
return !!win.frameElement;
|
128
|
+
};
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Helper closure to create a function that may be used to respond to a message
|
132
|
+
* @private
|
133
|
+
* @param {Window} source The window from which the message originated
|
134
|
+
* @param {String} topic The topic of the message
|
135
|
+
* @param {String} uuid The "unique" ID of the original message
|
136
|
+
* @return {Function} A function that may be invoked to respond to the message
|
137
|
+
*/
|
138
|
+
function createResponder(source, topic, uuid) {
|
139
|
+
return function(message, keepalive, callback) {
|
140
|
+
post(source, topic, message, uuid, keepalive, callback);
|
141
|
+
};
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Publishes the "respondable" message to the appropriate subscriber
|
146
|
+
* @private
|
147
|
+
* @param {Window} source The window from which the message originated
|
148
|
+
* @param {Object} data The data sent with the message
|
149
|
+
* @param {Boolean} keepalive Whether to allow multiple responses - default is false
|
150
|
+
*/
|
151
|
+
function publish(source, data, keepalive) {
|
152
|
+
var topic = data.topic;
|
153
|
+
var subscriber = subscribers[topic];
|
154
|
+
|
155
|
+
if (subscriber) {
|
156
|
+
var responder = createResponder(source, null, data.uuid);
|
157
|
+
subscriber(data.message, keepalive, responder);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Convert a javascript Error into something that can be stringified
|
163
|
+
* @param {Error} error Any type of error
|
164
|
+
* @return {Object} Processable object
|
165
|
+
*/
|
166
|
+
function buildErrorObject(error) {
|
167
|
+
var msg = error.message || 'Unknown error occurred';
|
168
|
+
var errorName = errorTypes.includes(error.name) ? error.name : 'Error';
|
169
|
+
var ErrConstructor = window[errorName] || Error;
|
170
|
+
|
171
|
+
if (error.stack) {
|
172
|
+
msg += '\n' + error.stack.replace(error.message, '');
|
173
|
+
}
|
174
|
+
return new ErrConstructor(msg);
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Parse the received message for processing
|
179
|
+
* @param {string} dataString Message received
|
180
|
+
* @return {object} Object to be used for pub/sub
|
181
|
+
*/
|
182
|
+
function parseMessage(dataString) {
|
183
|
+
/*eslint no-empty: 0*/
|
184
|
+
var data;
|
185
|
+
if (typeof dataString !== 'string') {
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
|
189
|
+
try {
|
190
|
+
data = JSON.parse(dataString);
|
191
|
+
} catch (ex) {}
|
192
|
+
|
193
|
+
if (!verify(data)) {
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
|
197
|
+
if (typeof data.error === 'object') {
|
198
|
+
data.error = buildErrorObject(data.error);
|
199
|
+
} else {
|
200
|
+
data.error = undefined;
|
201
|
+
}
|
202
|
+
return data;
|
203
|
+
}
|
204
|
+
|
205
|
+
if (typeof window.addEventListener === 'function') {
|
206
|
+
window.addEventListener(
|
207
|
+
'message',
|
208
|
+
function(e) {
|
209
|
+
/* eslint max-statements: ["error", 20]*/
|
210
|
+
var data = parseMessage(e.data);
|
211
|
+
if (!data) {
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
|
215
|
+
var uuid = data.uuid;
|
216
|
+
|
217
|
+
var keepalive = data._keepalive;
|
218
|
+
var callback = messages[uuid];
|
219
|
+
|
220
|
+
if (callback) {
|
221
|
+
var result = data.error || data.message;
|
222
|
+
var responder = createResponder(e.source, data.topic, uuid);
|
223
|
+
callback(result, keepalive, responder);
|
224
|
+
|
225
|
+
if (!keepalive) {
|
226
|
+
delete messages[uuid];
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
if (!data.error) {
|
231
|
+
try {
|
232
|
+
publish(e.source, data, keepalive);
|
233
|
+
} catch (err) {
|
234
|
+
post(e.source, data.topic, err, uuid, false);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
},
|
238
|
+
false
|
239
|
+
);
|
240
|
+
}
|
241
|
+
|
242
|
+
exports.respondable = respondable;
|
243
|
+
})(utils);
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/**
|
2
|
+
* Check if a rule matches the value of runOnly type=tag
|
3
|
+
* @private
|
4
|
+
* @param {object} rule
|
5
|
+
* @param {object} runOnly Value of runOnly with type=tags
|
6
|
+
* @return {bool}
|
7
|
+
*/
|
8
|
+
/* eslint complexity: ["error", 14]*/
|
9
|
+
function matchTags(rule, runOnly) {
|
10
|
+
'use strict';
|
11
|
+
var include, exclude, matching;
|
12
|
+
var defaultExclude =
|
13
|
+
axe._audit && axe._audit.tagExclude ? axe._audit.tagExclude : [];
|
14
|
+
|
15
|
+
// normalize include/exclude
|
16
|
+
if (runOnly.hasOwnProperty('include') || runOnly.hasOwnProperty('exclude')) {
|
17
|
+
// Wrap include and exclude if it's not already an array
|
18
|
+
include = runOnly.include || [];
|
19
|
+
include = Array.isArray(include) ? include : [include];
|
20
|
+
|
21
|
+
exclude = runOnly.exclude || [];
|
22
|
+
exclude = Array.isArray(exclude) ? exclude : [exclude];
|
23
|
+
// add defaults, unless mentioned in include
|
24
|
+
exclude = exclude.concat(
|
25
|
+
defaultExclude.filter(function(tag) {
|
26
|
+
return include.indexOf(tag) === -1;
|
27
|
+
})
|
28
|
+
);
|
29
|
+
|
30
|
+
// Otherwise, only use the include value, ignore exclude
|
31
|
+
} else {
|
32
|
+
include = Array.isArray(runOnly) ? runOnly : [runOnly];
|
33
|
+
// exclude the defaults not included
|
34
|
+
exclude = defaultExclude.filter(function(tag) {
|
35
|
+
return include.indexOf(tag) === -1;
|
36
|
+
});
|
37
|
+
}
|
38
|
+
|
39
|
+
matching = include.some(function(tag) {
|
40
|
+
return rule.tags.indexOf(tag) !== -1;
|
41
|
+
});
|
42
|
+
if (matching || (include.length === 0 && rule.enabled !== false)) {
|
43
|
+
return exclude.every(function(tag) {
|
44
|
+
return rule.tags.indexOf(tag) === -1;
|
45
|
+
});
|
46
|
+
} else {
|
47
|
+
return false;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Determines whether a rule should run
|
53
|
+
* @param {Rule} rule The rule to test
|
54
|
+
* @param {Context} context The context of the Audit
|
55
|
+
* @param {Object} options Options object
|
56
|
+
* @return {Boolean}
|
57
|
+
*/
|
58
|
+
axe.utils.ruleShouldRun = function(rule, context, options) {
|
59
|
+
'use strict';
|
60
|
+
var runOnly = options.runOnly || {};
|
61
|
+
var ruleOptions = (options.rules || {})[rule.id];
|
62
|
+
|
63
|
+
// Never run page level rules if the context is not on the page
|
64
|
+
if (rule.pageLevel && !context.page) {
|
65
|
+
return false;
|
66
|
+
|
67
|
+
// First, runOnly type rule overrides anything else
|
68
|
+
} else if (runOnly.type === 'rule') {
|
69
|
+
return runOnly.values.indexOf(rule.id) !== -1;
|
70
|
+
|
71
|
+
// Second, if options.rules[rule].enabled is set, it overrides all
|
72
|
+
} else if (ruleOptions && typeof ruleOptions.enabled === 'boolean') {
|
73
|
+
return ruleOptions.enabled;
|
74
|
+
|
75
|
+
// Third, if tags are set, look at those
|
76
|
+
} else if (runOnly.type === 'tag' && runOnly.values) {
|
77
|
+
return matchTags(rule, runOnly.values);
|
78
|
+
|
79
|
+
// If nothing is set, only check for default excludes
|
80
|
+
} else {
|
81
|
+
return matchTags(rule, []);
|
82
|
+
}
|
83
|
+
};
|