Re: Making <switch> useful

Hi Mr. chris,

> > I've therefore been wondering if there be interest in adding a @media 
> > test attribute for <switch>.

+1
http://www.w3.org/Graphics/SVG/WG/wiki/Proposals/IFrame_Like_Syntax#5.9.2_The_.27switch.27_
element

But, I like that it is the same element in HTML and SVG. And application coverage of switch is 
larger than picture.



Although cord size is big, similar processing can be expressed by Resource Priorities and css 
media queries.
===== switch + media attr.
<svg>
   <switch>
    <image media="(min-width: 45em)" xlink:href="large.jpg" width="500" height="500">
    <image media="(min-width: 18em)" xlink:href="med.jpg" width="500" height="500">
    <image xlink:href="small.jpg" width="500" height="500">
   </switch>
   <title>Accessible text</title>
</svg>


===== css media queries + Resource Priorities
<svg>
<style>
 @media (min-width: 18em){
  #sma{   display : none;  }
  #med{   display : inline;  }
 }
 @media (min-width: 45em){
  #sma{   display : none;  }
  #med{   display : none;  }
  #lar{   display : inline;  }
 }
</style>
<image id="lar" postpone display="none" src="large.jpg" width="500" height="500">
<image id="med" postpone display="none" src="med.jpg" width="500" height="500">
<image id="sma" postpone display="inline" src="small.jpg" width="500" height="500">
</svg>


Regards,

Satoru Takagi

> Hello Robin,
> 
> Monday, September 9, 2013, 9:48:56 PM, you wrote:
> 
> > I've therefore been wondering if there be interest in adding a @media 
> > test attribute for <switch>.
> 
> Yes, its a clear and obvious thing to do. Media queries evaluate to
> true or false so are a good fit for the switch construct.
> 
> Just had dinner with Marcos and Youav from the responsive images group
> (they are meeting tomorrow at Mozilla France, where CSS WG will be
> meeting the next three days) and they thought it was a good idea too.
> 
> >  I realise that it makes it dynamic;
> Its already dynamic (or should be).
> 
> >  though
> > I would hope that that has relatively minimal impact on implementation
> > (given that the DOM is there and live anyway). A somewhat clearer 
> > processing model for <switch> might have to be written, but it seems 
> > manageable.
> 
> > For backwards compatibility, it would currently be necessary to polyfill
> > @media ・but that's doable. If this proves useful for responsive images
> > though, I have to admit that I'll it would be rather tempting to just 
> > highjack this into HTML :)
> 
> Its an obvious combination that should be documented in SVG2.
> 
> Which html5 element(s) would it go on?
> 
> 
> -- 
> Best regards,
>  Chris                            mailto:chris@w3.org
> 
> 

Received on Tuesday, 10 September 2013 01:34:45 UTC