Last active
June 29, 2016 08:30
-
-
Save matijs/25311136539a74f4437f8db3cb4a7437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInteractiveElement( element ) { | |
if ( [ 'A', 'BUTTON', 'DETAILS', 'EMBED', 'IFRAME', 'KEYGEN', 'LABEL', 'SELECT', 'TEXTAREA' ].indexOf( element.nodeName ) !== -1 ) { | |
return true; | |
} | |
if ( element.nodeName === 'INPUT' && element.type !== 'hidden' ) { | |
return true; | |
} | |
if ( ['AUDIO', 'VIDEO'].indexOf( element.nodeName ) > -1 && element.hasAttribute('controls') ) { | |
return true; | |
} | |
if ( ['IMG', 'OBJECT'].indexOf( element.nodeName ) > -1 && element.hasAttribute('usemap') ) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment