ahume / Responsive-Images

An Experiment with Content Aware Images that Scale Responsively
http://filamentgroup.com/examples/responsive-images/
47 stars 4 forks source link

'Object doesn't support this property or method' (IE8) #5

Open paulrobertlloyd opened 12 years ago

paulrobertlloyd commented 12 years ago

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?

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);
            }
        }
    }
}