Feature queries (was Proposal: writing-mode media feature)

MURAKAMI Shinyu <murakami@antenna.co.jp> wrote on 2010/03/21 23:48:36
> "Tab Atkins Jr." <jackalmage@gmail.com> wrote on 2010/03/21 2:43:21
> > I don't think Media Queries is correct here; you're just wanting to
> > apply a set of rules only if another rule is supported.  There have
> > been suggestions on how to do that.  For example:
> > 
> > @requires {
> >   body {
> >     writing-mode: tb-rl !required;
> >   }
> > 
> >   blockquote {
> >     margin: 3em 0 0 0;
> >   }
> > }
> > 
> > Under this suggested syntax, the rules in the @required block would
> > only be used if all the !required rules within the block are fully
> > supported (both property and value are recognized by the browser).
> > This would fulfill your use-case, along with a bunch of others which
> > also have a bad fallback story.
> 
> Thanks for inform me, I'm sorry I missed the discussion about the 
> feature queries.
> 
> I am ok with this suggestion if CSSWG and implementors support this,
> although I don't think it's a bad idea using MQ for feature queries.


In the @requires syntax, how should be managed different verdor prefixed
properties?  For example:

@requires {
  body {
    -ah-writing-mode: tb-rl !required;
    -o-writing-mode: tb-rl !required;
    writing-mode: tb-rl !required;
  }

  blockquote {
    margin: 3em 0 0 0;
  }
}

This won't work because the @requires requires all !required
declarations, not one of them.

I think the feature queries functionality is very important and should
be standardized as soon as possible.  We should not invent a new complex
mechanism that affects CSS core syntax;

I dont understand why Media Queries is so bad for feature queries.
WebKit has Media Queries extensions already:
http://webkit.org/specs/MediaQueriesExtensions.html

Technically good, but semantically bad?
Is it ok if the spec name is "Media and UA-feature Queries" ?
If so we should change the spec name.

I want the following way:

<link rel="stylesheet" href="print-vertical.css" 
 media="print and supports(-ah-writing-mode: tb-rl; -o-writing-mode: tb-rl; writing-mode: tb-rl)"
/>

and when the property value is not important it should be omitted:
 media="print and supports(-ah-writing-mode; -o-writing-mode; writing-mode)"

Syntax:

media_query
 : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*
 | expression [ AND S* expression ]*
 ;

expression
 : '(' S* media_feature S* [':' S* expr]? ')' S*
 | ua_feature
 ;

ua_feature
 : 'supports(' S* ua_feature_decl [';' S* ua_feature_decl]* S* ')' S*
 ;

ua_feature_decl
 : property S* [':' S* value]?
 ;

Note that the separator ';' between multiple ua_feature_decl means "or".


-- 
ζ‘δΈŠ ηœŸι›„ (MURAKAMI Shinyu)
http://twitter.com/MurakamiShinyu
Antenna House Formatter:
http://www.antenna.co.jp/AHF/
http://www.antennahouse.com

Received on Friday, 26 March 2010 04:57:01 UTC