W3C home > Mailing lists > Public > www-style@w3.org > December 2009

Re: Feature queries

From: Zack Weinberg <zweinberg@mozilla.com>
Date: Wed, 9 Dec 2009 13:28:28 -0800
To: Pascal Germroth <pascal@germroth.name>
Cc: W3C Emailing list for WWW Style <www-style@w3.org>
Message-ID: <20091209132828.0c0f6053@trurl>
Pascal Germroth <pascal@germroth.name> wrote:
> 
> If media-query like operators were allowed, we need no @else:
>   @if supports( display: run-in; ) { ... }
>   @if supports( not(display: run-in); ) {...}

Then you have to write the expression twice, yuck.  And @elif becomes
awkwardly verbose.

> I think few people would use @else anyway, but instead use cascading:
>   div {...} /* default case */
>   @if supports( foo: bar; ) { div {...} /* special case*/ }

Maybe, but IMO the if/else construction is clearer; especially when you
have some shared properties and some conditional.

div { /* common */ }

@if supports( ... ) { div { /* cool stuff */ } }
@else { div { /* fallback */ } }

The generic grammar probably can't handle

div {
  /* common */
  @if supports (...) {
     /* cool stuff */
  } @else {
     /* fallback */
  }
}

more's the pity.

zw
Received on Wednesday, 9 December 2009 21:29:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:47:12 GMT