I've got a test case for this (with explanation) here:
http://ado.is-a-geek.net/expired/tests/image_cache_test.html
Boris Zbarsky believes this behaviour is required for compatibility so
I think it is worth adding to HTML5. This was discussed on the Mozilla
bug tracker here: https://bugzilla.mozilla.org/show_bug.cgi?id=295942
How do other browsers handle this? It seems to be possible to get
Opera and IE to throw the image away by changing the src attribute on
the img.
Are there similar caches for any other type of object or is this just
images?
Gecko has a similar (different in mechanism, but not too different in
effect) cache for stylesheets. I seem to recall that there was explicit
text about this as well, but I can't find it now. The closest I can
locate at the moment is the first paragraph at
http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resources.html#fetch
:
If the resource is identified by an absolute URL, and the resource
is to be obtained using an idempotent action (such as an HTTP GET
or equivalent), and it is already being downloaded for other reasons
(e.g. another invocation of this algorithm), and this request would
be identical to the previous one (e.g. same Accept and Origin
headers), and the user agent is configured such that it is to reuse
the data from the existing download instead of initiating a new one,
then use the results of the existing download instead of starting a
new one.
-Boris