ahume/Responsive-Images — Issue #5: 'Object doesn't support this property or method' (IE8)
Author: paulrobertlloyd
Created: 2012-02-12 00:03:34+00:00
State: open

Get this error when script is run in IE8. Points to line containing `img.addEventListener("load", function() {. Any clues as to what's breaking here?

```javascript
function findImages() {
var imgs = doc.getElementsByTagName('img');
for (var i = 0, j = imgs.length; i < j; ++i) {
var img = imgs[i];
if (img.src.indexOf("?r") > 0) {
// If 1x1 image hasn't loaded yet, add a load event listener.
// If we don't wait for load, image reports wrong size.
if (!img.complete) {
// Don't need to support old IE event model here, because we've
// already waited for images.
img.addEventListener("load", function() {
this.removeEventListener("load", arguments.callee, false);
testAndReplaceImage(this);
}, false);
} else {
testAndReplaceImage(img);
}
}
}
}
```