W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2011

[whatwg] Detached elements and delaying the load event

From: Andrew Oakley <andrew@ado.is-a-geek.net>
Date: Tue, 06 Sep 2011 14:03:55 +0100
Message-ID: <4E661A3B.5090900@ado.is-a-geek.net>
I'm going to use the <img> element as an example here, but the same
thing applies to other elements such as <iframe>, <video>, <audio>.

I'm going to assume that the user agent "obtains the images
immediately", given that seems to be what most browsers do.

If an img element is created and given a src attribute (but not
necessarily attached to the tree) then, according to HTML5, we need to
"update the image data" and therefore delay the load event.  I guess
this means we should lock the image element in a similar fashion to
XMLHttpRequest objects, otherwise the image could be garbage collected
before it has been loaded and therefore block the load event indefinitely.

Firefox, Opera, Chrome and Safari do seem to implement this behaviour,
IE does not.

I would prefer not to implement this and just say "detached elements do
not delay the load event", but I'm not sure if that will always work.

Can we please get a clarification in HTML5, either to say that these
detached objects must not be garbage collected while they are delaying
the load event, or to say that they do not delay the load event.

Thanks

-- 
Andrew Oakley
Received on Tuesday, 6 September 2011 06:03:55 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:36 UTC