Skip to content

Instantly share code, notes, and snippets.

@eduardolundgren
Created January 15, 2013 22:48
Show Gist options
  • Save eduardolundgren/4542913 to your computer and use it in GitHub Desktop.
Save eduardolundgren/4542913 to your computer and use it in GitHub Desktop.
// 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