Created
March 19, 2012 10:44
-
-
Save jakearchibald/2107184 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
document.body.addEventListener('error', function(event) { | |
if ( event.target.nodeName.toLowerCase() == 'img' ) { | |
// an image on the page failed to load | |
} | |
}, true); |
Interesting... but if you're testing enough elements to see a real world difference, you've probably got bigger problems.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You might consider testing the tag's name with regular expressions for better performance (see jsperf tests here and here).