[whatwg] "complete" DOM attribute (image elements)

Ian Hickson ian at hixie.ch
Fri Aug 28 18:59:08 PDT 2009

On Sun, 2 Sep 2007, Gavin Sharp wrote:
> (I searched the WHATWG and public-html mailing list archives to see 
> whether this issue had already been brought up, and couldn't find any 
> related discussion. Apologies if this has already been discussed.)
> The current HTML 5 draft says:
> "The DOM attribute complete must return true if the user agent has 
> downloaded the image specified in the src attribute, and it is a valid 
> image, and false otherwise."
> The "and it is a valid image" part seems to contradict the current 
> behavior of Safari 3.0.2, Opera 9.22, Firefox 2.0 and Firefox trunk (all 
> tested on Windows). These browser all give values of true for an invalid 
> image's "complete" property (see attached testcase or 
> http://people.mozilla.org/~gavin/test/img-complete.html ). Internet 
> Explorer 7 does seem to return false.
> It appears this behavior was explicitly chosen in Mozilla, in bug 190561 
> (https://bugzilla.mozilla.org/show_bug.cgi?id=190561). I think the 
> arguments given in that bug might merit reconsideration; detection of 
> image existence is currently possible by other means, and I'm not sure 
> how much weight "the Rhino Book" should have in influencing current DOM 
> specs.
> A similar issue also applies to the "error" event - IE and Safari seem 
> to fire "error" events on that testcase, while Firefox and Opera don't. 
> The fact that Safari fires an error event but still returns "true" for 
> <img>.complete seems like a bug.
> I don't have any opinion about which behavior is best in each of these 
> cases, but I thought I'd highlight the potential compatibility issue.

Thanks for your feedback.

My findings match yours. I have left the spec as is, for compatibility 
with IE, and because it seems the most logical.

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