eslint-plugin-jsx-a11y
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -17,2 +17,4 @@ 'use strict'; | ||
var DOMElements = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"]; | ||
var interactiveMap = { | ||
@@ -49,2 +51,8 @@ a: function a(attributes) { | ||
var isInteractiveElement = function isInteractiveElement(tagName, attributes) { | ||
// Do not test higher level JSX components, as we do not know what | ||
// low-level DOM element this maps to. | ||
if (DOMElements.indexOf(tagName) === -1) { | ||
return true; | ||
} | ||
if (interactiveMap.hasOwnProperty(tagName) === false) { | ||
@@ -51,0 +59,0 @@ return false; |
{ | ||
"name": "eslint-plugin-jsx-a11y", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "A static analysis linter of jsx and their accessibility with screen readers.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,2 +6,21 @@ 'use strict'; | ||
const DOMElements = [ | ||
"a", "abbr", "address", "area", "article", | ||
"aside", "audio", "b", "base", "bdi", "bdo", "big", | ||
"blockquote", "body", "br", "button", "canvas", "caption", | ||
"cite", "code", "col", "colgroup", "data", "datalist", | ||
"dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", | ||
"em", "embed", "fieldset", "figcaption", "figure", "footer", | ||
"form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", | ||
"hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", | ||
"kbd", "keygen", "label", "legend", "li", "link", "main", "map", | ||
"mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", | ||
"object", "ol", "optgroup", "option", "output", "p", "param", | ||
"picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", | ||
"samp", "script", "section", "select", "small", "source", "span", | ||
"strong", "style", "sub", "summary", "sup", "table", "tbody", | ||
"td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", | ||
"track", "u", "ul", "var", "video", "wbr" | ||
]; | ||
const interactiveMap = { | ||
@@ -30,2 +49,8 @@ a: attributes => { | ||
const isInteractiveElement = (tagName, attributes) => { | ||
// Do not test higher level JSX components, as we do not know what | ||
// low-level DOM element this maps to. | ||
if (DOMElements.indexOf(tagName) === -1) { | ||
return true; | ||
} | ||
if (interactiveMap.hasOwnProperty(tagName) === false) { | ||
@@ -32,0 +57,0 @@ return false; |
@@ -55,3 +55,4 @@ /** | ||
{ code: '<a onClick={() => void 0} href="http://x.y.z" />', parserOptions }, | ||
{ code: '<a onClick={() => void 0} href="http://x.y.z" tabIndex="0" />', parserOptions } | ||
{ code: '<a onClick={() => void 0} href="http://x.y.z" tabIndex="0" />', parserOptions }, | ||
{ code: '<TestComponent onClick={doFoo} />', parserOptions } | ||
], | ||
@@ -58,0 +59,0 @@ invalid: [ |
108266
2145