- From: Kornel Lesiński <kornel@geekhood.net>
- Date: Tue, 17 Sep 2013 19:46:43 +0100
- To: "Marcos Caceres" <w3c@marcosc.com>, "Cory Brown" <oh.wise.man@gmail.com>
- Cc: public-respimg@w3.org
On Tue, 17 Sep 2013 18:06:26 +0100, Cory Brown <oh.wise.man@gmail.com> wrote: >> - The algorithm picks the first <source> that matches. Matching is done >> based on media and type attributes. > > Agreed! > This would match the way video source is selected, but counter to the > way CSS @media rules cascade. I had to address this in > [x-picture](https://github.com/ResponsiveImagesCG/x-picture/blob/master/js/x-picture.js#L82) > and leaned on last (media) match wins. Selecting the first match makes > the selection algorithm simpler, but would mean authors address their > media attributes on source elements in the reverse order they would in > CSS. By no means a deal breaker, but since source elements with media > attributes merges two paradigms, I wanted to make sure it was at least > considered. I suppose no matter which way it went, first or last, it > would be opposite one of the paradigms picture is borrowing from. That's a very good point. Since <video> MQs are rare (might even be dropped from the spec) and authors are more likely to work with images+CSS MQ than just images+video MQ, it may be worth adjusting the order. I don't know why, but to me it somehow makes sense that in cascade last override wins, but in sources first match wins (maybe I've been thinking too much about the implementation :) Could we do usability study or a survey to know how typical page authors envision it? e.g. ask authors what they'd expect from this markup: <picture> <source src="blue.png"> <source src="orange.png"> </picture> -- regards, Kornel
Received on Tuesday, 17 September 2013 18:47:16 UTC