W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2013

[whatwg] Image.complete in broken state

From: Kornel Lesiński <kornel@geekhood.net>
Date: Wed, 30 Oct 2013 22:49:32 -0000
To: whatwg <whatwg@whatwg.org>
Message-ID: <op.w5shoutbte2ec8@aimac.local>

The spec states:

> The IDL attribute `complete` must return true if […]The final task that  
> is queued by the networking task source once the resource has been  
> fetched has been queued, but has not yet been run, and the img element  
> is not in the broken state.
> The img element is completely available.


If I understand correctly the spec calls for Image.complete to be false  
when the image is broken — and this doesn't match implementations. At  
least Firefox, Chrome and Safari set image.complete == true when the image  
is broken. Test case:

<img src="data:image/gif,broken" onerror="alert(this.complete)">

Having complete == true set on broken images is actually useful: it allows  
distinguishing between images that haven't been loaded yet and images that  
have been loaded and failed to decode (.complete == true && .naturalWidth  
== 0).

regards, Kornel
Received on Wednesday, 30 October 2013 22:50:21 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:12 UTC