3
3
import hasAttribute from './hasAttribute' ;
4
4
import getAttributeValue from './getAttributeValue' ;
5
5
6
+ const DOMElements = [
7
+ "a" , "abbr" , "address" , "area" , "article" ,
8
+ "aside" , "audio" , "b" , "base" , "bdi" , "bdo" , "big" ,
9
+ "blockquote" , "body" , "br" , "button" , "canvas" , "caption" ,
10
+ "cite" , "code" , "col" , "colgroup" , "data" , "datalist" ,
11
+ "dd" , "del" , "details" , "dfn" , "dialog" , "div" , "dl" , "dt" ,
12
+ "em" , "embed" , "fieldset" , "figcaption" , "figure" , "footer" ,
13
+ "form" , "h1" , "h2" , "h3" , "h4" , "h5" , "h6" , "head" , "header" ,
14
+ "hgroup" , "hr" , "html" , "i" , "iframe" , "img" , "input" , "ins" ,
15
+ "kbd" , "keygen" , "label" , "legend" , "li" , "link" , "main" , "map" ,
16
+ "mark" , "menu" , "menuitem" , "meta" , "meter" , "nav" , "noscript" ,
17
+ "object" , "ol" , "optgroup" , "option" , "output" , "p" , "param" ,
18
+ "picture" , "pre" , "progress" , "q" , "rp" , "rt" , "ruby" , "s" ,
19
+ "samp" , "script" , "section" , "select" , "small" , "source" , "span" ,
20
+ "strong" , "style" , "sub" , "summary" , "sup" , "table" , "tbody" ,
21
+ "td" , "textarea" , "tfoot" , "th" , "thead" , "time" , "title" , "tr" ,
22
+ "track" , "u" , "ul" , "var" , "video" , "wbr"
23
+ ] ;
24
+
6
25
const interactiveMap = {
7
26
a : attributes => {
8
27
const hasHref = hasAttribute ( attributes , 'href' ) ;
@@ -26,6 +45,12 @@ const interactiveMap = {
26
45
* it's intention is to be interacted with on the DOM.
27
46
*/
28
47
const isInteractiveElement = ( tagName , attributes ) => {
48
+ // Do not test higher level JSX components, as we do not know what
49
+ // low-level DOM element this maps to.
50
+ if ( DOMElements . indexOf ( tagName ) === - 1 ) {
51
+ return true ;
52
+ }
53
+
29
54
if ( interactiveMap . hasOwnProperty ( tagName ) === false ) {
30
55
return false ;
31
56
}
0 commit comments