Socket
Socket
Sign inDemoInstall

a11y-checker

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

2

dist/a11y.js

@@ -1,1 +0,1 @@

!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=5)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){return document.querySelector(t)},r=function(t){return document.querySelectorAll(t)},a=function(t,e){return t.hasAttribute(e)},s=function(t,e){return t.getAttribute(e)},o=document.doctype,u=document.title,c=function(t){return a(t,"aria-label")||a(t,"aria-labelledby")},l=function(t){return 0===t.textTracks.length};e.getElement=i,e.getElements=r,e.hasAttribute=a,e.getAttribute=s,e.doctype=o,e.title=u,e.hasAccessibileText=c,e.hasTrack=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){return t.toLowerCase()},r=function(t){return""===t.trim()},a=function(t){return null===t};e.toLower=i,e.isEmpty=r,e.isNull=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){return console.warn(t)};e.Warning=i},function(t,e,n){"use strict";function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.hasDuplicateIds=e.hasPositiveTabIndex=e.hasAudioTrack=e.hasVideoTrack=e.hasForLabel=e.hasIframeTitle=e.hasFormsLabel=e.hasSVGRole=e.hasButtonsText=e.hasLinksTarget=e.hasLinksHref=e.hasLinksText=e.hasImagesAlt=e.hasHeadingOnce=void 0;var r=n(2),a=n(1),s=n(0),o=function(){(0,s.getElements)("h1").length>1&&(0,r.Warning)("Page has Multi <h1> tag. Fix: use only one <h1> in the page.")},u=function(){var t=[].concat(i((0,s.getElements)("img"))),e=t.filter(function(t){return!(0,s.hasAttribute)(t,"alt")});e.length,e.forEach(function(t){return(0,r.Warning)('Image Alt is missing. Fix: Add alt="IMAGE WELL DESCRIBED" to '+t.outerHTML)})},c=function(){var t=[].concat(i((0,s.getElements)("a"))),e=t.filter(function(t){return(0,a.isEmpty)(t.textContent)&&!(0,s.hasAccessibileText)(t)});e.length,e.forEach(function(t){return(0,r.Warning)("Link text is missing. Fix: DESCRIBE PURPOSE OF LINK to "+t.outerHTML)})},l=function(){var t=[].concat(i((0,s.getElements)("a"))),e=t.filter(function(t){return((0,a.isEmpty)((0,s.getAttribute)(t,"href"))||!(0,s.hasAttribute)(t,"href"))&&!(0,s.hasAttribute)(t,"role")});e.length,e.forEach(function(t){return(0,r.Warning)('Link Href is missing. Fix: Add href="LINK URL" to '+t.outerHTML)})},f=function(){var t=[].concat(i((0,s.getElements)("a"))),e=t.filter(function(t){return"_blank"===(0,s.getAttribute)(t,"target")&&!(0,s.hasAttribute)(t,"aria-describedby")});e.length,e.forEach(function(t){return(0,r.Warning)('Hint message is missing. Should add hint message to recognize this link will open in new tab. Fix: Add aria-describedby="ELEMENT ID" to '+t.outerHTML)})},h=function(){var t=[].concat(i((0,s.getElements)("button"))),e=t.filter(function(t){return(0,a.isEmpty)(t.textContent)&&!(0,s.hasAccessibileText)(t)});e.length,e.forEach(function(t){return(0,r.Warning)('Button text or aria-label is missing. Fix: Add aria-label="VALUE" or <button>VALUE</button> to '+t.outerHTML)})},g=function(){var t=[].concat(i((0,s.getElements)("label"))),e=function(t){(0,s.hasAttribute)(t,"for")&&!(0,a.isEmpty)((0,s.getAttribute)(t,"for"))||(0,r.Warning)('For is missing in label. Fix: Add for="INPUT ID" to '+t.outerHTML)};return t.forEach(e)},m=function(){[].concat(i((0,s.getElements)("SVG"))).some(function(t){return"true"!==(0,s.getAttribute)(t,"aria-hidden")&&!(0,s.hasAttribute)(t,"role")})&&(0,r.Warning)('SVG Role is missing. Fix: Add role="img" or (aria-hidden="true" if you need to hide element from SR).')},d=function(){[].concat(i((0,s.getElements)("iframe"))).some(function(t){return!(0,s.hasAttribute)(t,"title")})&&(0,r.Warning)('Title is missing in iframe. Fix: Add title="DESCRIBE CONTENT OF FRAME" to <iframe>')},b=function(){[].concat(i((0,s.getElements)("video"))).some(s.hasTrack)&&(0,r.Warning)("Video track is missing. Fix: Add <track> element with subtitles, captions to >video>")},A=function(){[].concat(i((0,s.getElements)("audio"))).some(s.hasTrack)&&(0,r.Warning)("Audio track is missing. Fix: Add <track> element with subtitles, captions to <audio>")},E=function(){[].concat(i((0,s.getElements)("form"))).some(function(t){return!(0,s.hasAccessibileText)(t)})&&(0,r.Warning)("Forms Label is missing. Fix: Add aria-label, aria-labelledby to <form>")},T=function(){[].concat(i((0,s.getElements)("*"))).filter(function(t){return(0,s.getAttribute)(t,"tabindex")>0}).length>0&&(0,r.Warning)('Avoid using positive integer values for tabindex. Fix: Remove/Replace tabindex=">0" ')},L=function(){var t=[].concat(i((0,s.getElements)("*"))),e=t.map(function(t){return(0,s.getAttribute)(t,"id")}).filter(function(t){return!(0,a.isNull)(t)}),n=[].concat(i(new Set(e)));e.length>n.length&&(0,r.Warning)("Avoid duplicate ids, ID must be unique. Fix: Remove/Replace duplicate id")};e.hasHeadingOnce=o,e.hasImagesAlt=u,e.hasLinksText=c,e.hasLinksHref=l,e.hasLinksTarget=f,e.hasButtonsText=h,e.hasSVGRole=m,e.hasFormsLabel=E,e.hasIframeTitle=d,e.hasForLabel=g,e.hasVideoTrack=b,e.hasAudioTrack=A,e.hasPositiveTabIndex=T,e.hasDuplicateIds=L},function(t,e,n){"use strict";function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.hasDocumentScalable=e.hasDocumentMetaCharset=e.hasDocumentTitle=e.hasDocumentLanguage=e.hasDocumentType=void 0;var r=n(2),a=n(1),s=n(0),o=function(){s.doctype||(0,r.Warning)("Doctype is missing. Fix: Add <!DOCTYPE html>")},u=function(){(0,a.isEmpty)(s.title)&&(0,r.Warning)("Title is missing. Fix: <title>WELL DESCRIBED TITLE</title>")},c=function(){var t=(0,s.getElement)("html");if((0,s.hasAttribute)(t,"lang")){var e=(0,s.getAttribute)(t,"lang");(0,a.isEmpty)(e)&&(0,r.Warning)('Language value is missing in HTML element. Fix: Add lang="LANGUAGE VALUE" to <html>')}else(0,r.Warning)('Language is missing in HTML element. Fix: Add lang="LANGUAGE VALUE" to <html>')},l=function(){[].concat(i((0,s.getElements)("meta"))).some(function(t){return(0,s.hasAttribute)(t,"charset")})||(0,r.Warning)('Document encoding is missing. Fix: Add <meta charset="utf-8"/>')},f=function(){[].concat(i((0,s.getElements)("meta"))).some(function(t){return"no"===(0,s.getAttribute)(t,"user-scalable")})&&(0,r.Warning)("Document must not use the user-scalable=no. Fix: Remove user-scalable=no from <meta name=viewport>")};e.hasDocumentType=o,e.hasDocumentLanguage=c,e.hasDocumentTitle=u,e.hasDocumentMetaCharset=l,e.hasDocumentScalable=f},function(t,e,n){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),a=i(r),s=n(3),o=i(s),u=function(){a.hasDocumentType(),a.hasDocumentTitle(),a.hasDocumentLanguage(),a.hasDocumentMetaCharset(),a.hasDocumentScalable(),o.hasHeadingOnce(),o.hasImagesAlt(),o.hasLinksText(),o.hasLinksHref(),o.hasLinksTarget(),o.hasButtonsText(),o.hasSVGRole(),o.hasIframeTitle(),o.hasFormsLabel(),o.hasForLabel(),o.hasVideoTrack(),o.hasAudioTrack(),o.hasPositiveTabIndex(),o.hasDuplicateIds()}();e.default=u}]);
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("a11yChecker",[],t):"object"==typeof exports?exports.a11yChecker=t():e.a11yChecker=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=5)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){return document.querySelector(e)},r=function(e){return document.querySelectorAll(e)},a=function(e,t){return e.hasAttribute(t)},o=function(e,t){return e.getAttribute(t)},s=document.doctype,u=document.title,c=function(e){return a(e,"aria-label")||a(e,"aria-labelledby")},l=function(e){return 0===e.textTracks.length};t.getElement=i,t.getElements=r,t.hasAttribute=a,t.getAttribute=o,t.doctype=s,t.title=u,t.hasAccessibileText=c,t.hasTrack=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){return e.toLowerCase()},r=function(e){return""===e.trim()},a=function(e){return null===e};t.toLower=i,t.isEmpty=r,t.isNull=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){return console.warn(e)};t.Warning=i},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.hasDuplicateIds=t.hasPositiveTabIndex=t.hasAudioTrack=t.hasVideoTrack=t.hasForLabel=t.hasIframeTitle=t.hasFormsLabel=t.hasSVGRole=t.hasButtonsText=t.hasLinksTarget=t.hasLinksHref=t.hasLinksText=t.hasImagesAlt=t.hasHeadingOnce=void 0;var r=n(2),a=n(1),o=n(0),s=function(){(0,o.getElements)("h1").length>1&&(0,r.Warning)("Page has Multi <h1> tag. Fix: use only one <h1> in the page.")},u=function(){var e=[].concat(i((0,o.getElements)("img"))),t=e.filter(function(e){return!(0,o.hasAttribute)(e,"alt")});t.length,t.forEach(function(e){return(0,r.Warning)('Image Alt is missing. Fix: Add alt="IMAGE WELL DESCRIBED" to '+e.outerHTML)})},c=function(){var e=[].concat(i((0,o.getElements)("a"))),t=e.filter(function(e){return(0,a.isEmpty)(e.textContent)&&!(0,o.hasAccessibileText)(e)});t.length,t.forEach(function(e){return(0,r.Warning)("Link text is missing. Fix: DESCRIBE PURPOSE OF LINK to "+e.outerHTML)})},l=function(){var e=[].concat(i((0,o.getElements)("a"))),t=e.filter(function(e){return((0,a.isEmpty)((0,o.getAttribute)(e,"href"))||!(0,o.hasAttribute)(e,"href"))&&!(0,o.hasAttribute)(e,"role")});t.length,t.forEach(function(e){return(0,r.Warning)('Link Href is missing. Fix: Add href="LINK URL" to '+e.outerHTML)})},f=function(){var e=[].concat(i((0,o.getElements)("a"))),t=e.filter(function(e){return"_blank"===(0,o.getAttribute)(e,"target")&&!(0,o.hasAttribute)(e,"aria-describedby")});t.length,t.forEach(function(e){return(0,r.Warning)('Hint message is missing. Should add hint message to recognize this link will open in new tab. Fix: Add aria-describedby="ELEMENT ID" to '+e.outerHTML)})},h=function(){var e=[].concat(i((0,o.getElements)("button"))),t=e.filter(function(e){return(0,a.isEmpty)(e.textContent)&&!(0,o.hasAccessibileText)(e)});t.length,t.forEach(function(e){return(0,r.Warning)('Button text or aria-label is missing. Fix: Add aria-label="VALUE" or <button>VALUE</button> to '+e.outerHTML)})},m=function(){var e=[].concat(i((0,o.getElements)("label"))),t=function(e){(0,o.hasAttribute)(e,"for")&&!(0,a.isEmpty)((0,o.getAttribute)(e,"for"))||(0,r.Warning)('For is missing in label. Fix: Add for="INPUT ID" to '+e.outerHTML)};return e.forEach(t)},g=function(){[].concat(i((0,o.getElements)("SVG"))).some(function(e){return"true"!==(0,o.getAttribute)(e,"aria-hidden")&&!(0,o.hasAttribute)(e,"role")})&&(0,r.Warning)('SVG Role is missing. Fix: Add role="img" or (aria-hidden="true" if you need to hide element from SR).')},d=function(){[].concat(i((0,o.getElements)("iframe"))).some(function(e){return!(0,o.hasAttribute)(e,"title")})&&(0,r.Warning)('Title is missing in iframe. Fix: Add title="DESCRIBE CONTENT OF FRAME" to <iframe>')},b=function(){[].concat(i((0,o.getElements)("video"))).some(o.hasTrack)&&(0,r.Warning)("Video track is missing. Fix: Add <track> element with subtitles, captions to >video>")},A=function(){[].concat(i((0,o.getElements)("audio"))).some(o.hasTrack)&&(0,r.Warning)("Audio track is missing. Fix: Add <track> element with subtitles, captions to <audio>")},E=function(){[].concat(i((0,o.getElements)("form"))).some(function(e){return!(0,o.hasAccessibileText)(e)})&&(0,r.Warning)("Forms Label is missing. Fix: Add aria-label, aria-labelledby to <form>")},p=function(){[].concat(i((0,o.getElements)("*"))).filter(function(e){return(0,o.getAttribute)(e,"tabindex")>0}).length>0&&(0,r.Warning)('Avoid using positive integer values for tabindex. Fix: Remove/Replace tabindex=">0" ')},T=function(){var e=[].concat(i((0,o.getElements)("*"))),t=e.map(function(e){return(0,o.getAttribute)(e,"id")}).filter(function(e){return!(0,a.isNull)(e)}),n=[].concat(i(new Set(t)));t.length>n.length&&(0,r.Warning)("Avoid duplicate ids, ID must be unique. Fix: Remove/Replace duplicate id")};t.hasHeadingOnce=s,t.hasImagesAlt=u,t.hasLinksText=c,t.hasLinksHref=l,t.hasLinksTarget=f,t.hasButtonsText=h,t.hasSVGRole=g,t.hasFormsLabel=E,t.hasIframeTitle=d,t.hasForLabel=m,t.hasVideoTrack=b,t.hasAudioTrack=A,t.hasPositiveTabIndex=p,t.hasDuplicateIds=T},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.hasDocumentScalable=t.hasDocumentMetaCharset=t.hasDocumentTitle=t.hasDocumentLanguage=t.hasDocumentType=void 0;var r=n(2),a=n(1),o=n(0),s=function(){o.doctype||(0,r.Warning)("Doctype is missing. Fix: Add <!DOCTYPE html>")},u=function(){(0,a.isEmpty)(o.title)&&(0,r.Warning)("Title is missing. Fix: <title>WELL DESCRIBED TITLE</title>")},c=function(){var e=(0,o.getElement)("html");if((0,o.hasAttribute)(e,"lang")){var t=(0,o.getAttribute)(e,"lang");(0,a.isEmpty)(t)&&(0,r.Warning)('Language value is missing in HTML element. Fix: Add lang="LANGUAGE VALUE" to <html>')}else(0,r.Warning)('Language is missing in HTML element. Fix: Add lang="LANGUAGE VALUE" to <html>')},l=function(){[].concat(i((0,o.getElements)("meta"))).some(function(e){return(0,o.hasAttribute)(e,"charset")})||(0,r.Warning)('Document encoding is missing. Fix: Add <meta charset="utf-8"/>')},f=function(){[].concat(i((0,o.getElements)("meta"))).some(function(e){return"no"===(0,o.getAttribute)(e,"user-scalable")})&&(0,r.Warning)("Document must not use the user-scalable=no. Fix: Remove user-scalable=no from <meta name=viewport>")};t.hasDocumentType=s,t.hasDocumentLanguage=c,t.hasDocumentTitle=u,t.hasDocumentMetaCharset=l,t.hasDocumentScalable=f},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),a=i(r),o=n(3),s=i(o),u=function(){a.hasDocumentType(),a.hasDocumentTitle(),a.hasDocumentLanguage(),a.hasDocumentMetaCharset(),a.hasDocumentScalable(),s.hasHeadingOnce(),s.hasImagesAlt(),s.hasLinksText(),s.hasLinksHref(),s.hasLinksTarget(),s.hasButtonsText(),s.hasSVGRole(),s.hasIframeTitle(),s.hasFormsLabel(),s.hasForLabel(),s.hasVideoTrack(),s.hasAudioTrack(),s.hasPositiveTabIndex(),s.hasDuplicateIds()}();t.default=u}])});
{
"name": "a11y-checker",
"version": "2.0.0",
"version": "2.0.1",
"description": "Identifies accessibility issues in your code.",

@@ -5,0 +5,0 @@ "main": "a11y.js",

@@ -6,3 +6,6 @@ module.exports = {

publicPath: '/dist/',
filename: 'a11y.js'
filename: 'a11y.js',
library: 'a11yChecker',
libraryTarget: 'umd',
umdNamedDefine: true
},

@@ -9,0 +12,0 @@ module: {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc