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

(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.

Gavin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070902/ef4f843d/attachment.html>

Received on Sunday, 2 September 2007 20:35:56 UTC