[whatwg] <object> behavior

Michael A. Puls II shadow2531 at gmail.com
Fri Sep 18 15:35:20 PDT 2009


On Fri, 18 Sep 2009 14:43:39 -0400, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> On 9/18/09 10:21 AM, Michael A. Puls II wrote:
>> Attaching a test.
>> So, is it IE's behavior we want here, or Opera's?
>
> In my opinion, neither.  We don't want to have plug-in instantiation  
> depending on the CSS box model at all (and want to instantiate even if  
> display is "none").  If that's not feasible, then IE's model is imo  
> preferable to Opera's "sometimes it'll restart sometimes not" model....
>
>> Or, are you saying that the <object> should also load the plug-in even
>> when its display is set to none by default?
>
> That seems like the most self-consistent approach to me.

Thanks. Seeing all the inconsistent behavior in browsers now, this sounds  
like a great idea.

But:

With <object style="display: none" data="file.swf?vid=file.flv"> when the  
page is parsed (or added to the document), what would happen?

Would it be something like this?:

1. Create the plug-in instance.

2. fetch file.swf

3. Give the file.swf stream to the plug-in when it requests it.

4. Fetch file.flv when the plug-in requests it

5. If autoplay, start playing the video (audio only since the <object>  
isn't shown)

Or, would it stop after #1 where everything else is delayed till the  
<object>'s display is set to something other than none and is scrolled  
into view (and, if applicable, the background tab/page that the <object>  
is in is focused)?

Or, would those optimizations not be triggered at all by display: none, or  
would it depend on the plug-in or plug-in API or whatever the browser  
feels like doing?

Or, would it stop after #2 is done and continue when the <object>'s  
display is set to something other than none?

In other words, if browsers make it so display: none doesn't prevent the  
loading of a plug-in, does display: none still prevent the automatic  
streaming of the file in @data by the browser (for plug-ins, not native  
types like text/html)? Or, will the browser always fetch the file (unless  
the plug-in decides to tell the browser to cancel the stream)?

The reason I ask is that if existing web pages use multiple <object>'s  
that load videos for example, that are initially set to display: none and  
only shown later, then if browsers start fetching all these files as soon  
as the page loads, it might affect page loading because of bandwidth and  
cpu etc. It would also affect bandwidth use in general as videos that you  
might not even watch would be fetched.

If this is a concern, then IE's approach of not loading the plug-in if the  
<object> is set to display: none when it's attached to the document might  
make better sense than making display: none not have any affect at all.

Or, pages like that (I will try to find some real examples) would have to  
change things like the following if they don't want an <object> to stream  
until they're ready.

<object style="display: none"></object> <!-- set @type or @data later -->

<object style="display: none" data-type="application/x-shockwave-flash"  
data-data="file.swf"></object> <!-- set @type or @data later by using info  
in the markup for what plug-in and file to load -->

For new pages, going in knowing these things, you just wouldn't add an  
<object> to the document until you were ready.

Or, should there be some attribute that prevents a plug-in from  
automatically loading when it's attached to a document like an empty  
boolean plug-in-disabled?

-- 
Michael



More information about the whatwg mailing list