Is there a way to determine which event handlers are initially available for an HTML element?
For instance:
isAvailable(img.onload) === true; // All browsers isAvailable(script.onload) === true; // Non-IE only (Webkit, Firefox, Opera) isAvailable(link.onload) === true; // IE (and I think Opera) only
Ideally, I want to do a function detection in my script, where if onload is available for the element that will use it, otherwise it's a reserve. Currently, I have to make browser forks (based on IE), which is annoying since IE may start supporting script.onload and Webkit / Firefox may start supporting link.onload.
Unfortunately, the purpose of element.onload makes the event no longer "undefined", regardless of whether it will eventually fire or not.
Thanks!
source share