This project is archived and is in readonly mode.

#119 ✓invalid
xintron

Asset.images - document.id(image)

Reported by xintron | September 13th, 2009 @ 11:06 PM

When loading images using Asset.images using:

var loader = new Asset.images(['http://domain.com/image/test.jpg', 'http://domain.com/image/test2.jpg'], {

    onComplete: function() {
            alert('Hey hey hey there');
    }



});

It fails with the following error (firebug output): document.id is not a function. It works if I remove document.id from the image-function. Is this a bug or not?

image: function(source, properties){
        properties = $merge({
        onload: $empty,
        onabort: $empty,
        onerror: $empty
    }, properties);
    var image = new Image();
    var element = **document.id(image)** || new Element('img');
    ['load', 'abort', 'error'].each(function(name){
        var type = 'on' + name;
        var event = properties[type];
        delete properties[type];
        image[type] = function(){
            if (!image) return;
            if (!element.parentNode){
                element.width = image.width;
                element.height = image.height;
            }
            image = image.onload = image.onabort = image.onerror = null;
            event.delay(1, element, element);
            element.fireEvent(name, element, 1);
        };
    });
    image.src = element.src = source;
    if (image && image.complete) image.onload.delay(1);
    return element.set(properties);
}

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket

Pages