Created
January 15, 2013 22:48
-
-
Save eduardolundgren/4542913 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
// Simple version of http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ | |
function isEventSupported(node, eventName) { | |
eventName = 'on' + eventName; | |
if (!(eventName in node)) { | |
if (!node.setAttribute) { | |
node = document.createElement('div'); | |
} | |
if (node.setAttribute) { | |
node.setAttribute(eventName, ''); | |
return (typeof node[eventName] === 'function'); | |
} | |
} | |
node = null; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment