[whatwg] 'hidden' as resources control (Was: Simplified <picture> element draft)

Boris Zbarsky bzbarsky at MIT.EDU
Thu Jan 23 19:52:11 PST 2014

On 1/23/14 9:13 PM, Bruno Racineux wrote:
> Then how come it is the case right now for both:
> <object style="display:none" data="image.png">

Gecko's preloader never preloads <object>s.  There are various reasons 
for this, but the most important one is that in practice it doesn't 
matter for actual web pages and hence no one has bothered to write the 
extra code to make it work.

> Not only the pre-loader doesn't load the data-src
> but "image.png" doesn't actually load at all.

How did you determine that last, if I might ask?

I just tested in Gecko and Gecko does in fact load the image if the 
above markup is used.  Normal load, once the element has been created, 
not preload.

It's not trivial to tell that with an image, but here's a testcase that 
makes it crystal clear what's going on:

<!DOCTYPE html>
<object style="display: none"
   onload = function() {
     var obj = document.querySelector("object");

This works just fine in Gecko.  It looks like WebKit/Blink do something 
weird here, but that just sounds like a bug.

> Well legacy behavior has made it so... just seems quite flawed in
> responsive design context where you'd expect the ability to set resources
> in the DOM with some control as to wether they ought to load or not,

Sure.  That's why there's all this discussion about controlling 
precisely that!

> Could 'resource control' be an associated spec of the 'hidden' attribute?

It bothers me, at first glance, to overload the attribute to mean 
different things.  I predict people will appear who want the hidden 
thing to hide but still want loading/preloading.

It would be better to just have a separate attribute for the separate 
task if we go this direction.


More information about the whatwg mailing list