[whatwg] Image.complete in broken state

Ian Hickson ian at hixie.ch
Fri Dec 6 11:10:31 PST 2013


On Wed, 30 Oct 2013, Kornel Lesiński wrote:
> 
> 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.
> 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#dom-img-complete
> 
> 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).

I've attempted to fix the spec accordingly. I would appreciate it if 
people could check my work here to make sure I didn't miss any cases!

   http://whatwg.org/html/#dom-img-complete

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list