desandro/imagesloaded — pull request #15 by Darsain (2012-01-11 20:44:39+00:00)
Title: Deferred support with differentiation between proper and broken images

Referencing the issue #13...

It turns out that - since we are force-reloading all images - differentiating between proper and broken images is as simple as `event.type == 'error'` :) With that in mind I've advanced forward and modified the plugin to return the original jQuery wrapped container, extended with deferred object. Also, I've added more arguments to the original callback.

### Deferred object behavior

Deferred is **Resolved** when all images have been properly loaded.
Deferred is **Rejected** when at least one image is broken.
Deferred is **Notified** every time an image from stack has finished loading.

### Deferred methods arguments

`.done( function( $all_images ){ ... } )`

`.fail( function( $all_images, $proper_images, $broken_images ){ ... } )`

`.progress( function( images_count, loaded_count, proper_count, broken_count ){ ... } )`

### Original imagesLoaded callback arguments

`.imagesLoaded( function( $all_images, $proper_images, $broken_images ){ ... } )`

### index.html

I've took the liberty and changed the `index.html` example to better represent the new `imagesLoaded` functionality :)

Also, on completely unrelated note: @desandro, can you please please please code with tabs as indentation? :) I can give you multiple reasons why, if you want :)