[whatwg] Fallback behavior

Ian Hickson ian at hixie.ch
Tue Aug 19 02:50:06 PDT 2008


On Mon, 12 Mar 2007, Maciej Stachowiak wrote:
> 
> As far as I can tell, the current spec does not adequately define how 
> fallback behavior works. Specifically, what should be done with fallback 
> content when not falling back?

In theory, this is now defined for all element combinations. Please let me 
know if there's anything in the spec that's still undefined. Note in 
particular that unless contradicted elsewhere, requirements in the spec 
are intended to apply regardless of other conditions, so unless mention is 
explicitly made of fallback, whether an element is fallback content or not 
doesn't affect its requirements.


> <canvas>
> <b>fallback</b>
> <script>
> alert('x');
> </script>
> </canvas>
> 
> <object data="about:blank">
> <b>fallback</b>
> <script>
> alert('y');
> </script>
> </object>

Both of these should result in an elert.


On Tue, 13 Mar 2007, Martin Atkins wrote:
> 
> Also,
> 
> <object id="movie" data="movie.ogg">
>    <object id="movie" data="movie.mov">
>       <object id="movie" data="movie.asf">
>          <p>Blah blah movie alternative text...</p>
>       </object>
>    </object>
> </object>
> 
> If these things remain in the DOM, authors will presumably need to give 
> them all distinct "id" values.
>
> Now if I want to access these things from script, such as to provide an 
> alternative player UI, I need to somehow determine which one is actually 
> being used in order to target it. If they're all in the DOM, I can't 
> just rely on getElementById returning null for the unused cases.
> 
> What's the solution in this case?

Use <video>.


On Tue, 13 Mar 2007, Anne van Kesteren wrote:
> 
> Currently they apply, as far as I know. I'm not sure what should happen. 
> The case that bugs me most is something like
> 
>   <object data=foo>
>     <object data=bar>
> 
> where foo and bar both start playing something, but you can't actually 
> see bar or turn it off...

It's similar to how you can have an iframe that contains an <audio> 
element even if the iframe is display:none.


On Tue, 13 Mar 2007, Maciej Stachowiak wrote:
> 
> I don't think CSS can define the rules for fallback, since it has no way 
> to express the fact that an element is unable to present its primary 
> contents for a wide variety of possible reasons.

I had proposed extensions to 'content' that would formalise this somewhat, 
but in general I agree that CSS isn't capable of fully describing HTML's 
rendering conventions.


> > Currently they apply, as far as I know. I'm not sure what should 
> > happen. The case that bugs me most is something like
> > 
> >   <object data=foo>
> >     <object data=bar>
> > 
> > where foo and bar both start playing something, but you can't actually 
> > see bar or turn it off...
> 
> bar shouldn't start playing in that case, should it?

Per the spec today, it should.


On Tue, 13 Mar 2007, Anne van Kesteren wrote:
> 
> Not sure. Should
> 
>   <object data=foo>
>     <img src=bar onload=alert('x')>
> 
> show a modal dialog?

Yes.


On Tue, 13 Mar 2007, Mihai Sucan wrote:
> 
> No, it should not.

It's too late to change this, browsers uniformly do it the same way.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list