W3C home > Mailing lists > Public > www-style@w3.org > September 2012

[css-variables] Feature detection and 'variables' (Issue 2)

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Thu, 6 Sep 2012 11:45:25 +0200
Message-ID: <161C2056AFDC4F0B8B959F91CA80FA6C@FREMYD2>
To: "CSS WG" <www-style@w3.org>
The introduction of property references may mean we lost the ability to target browser by feature detection. Since ‘variables’ are resolved at computation time, it’s not possible at this time to provide ‘fallback values’ in the case a property doesn’t recognize the value stored in a valid custom property.

The proposal I made to solve this issue is a static checking at the parse time that would reject declarations containing property references whose fallback value isn’t recognized by the browser :
  .selector {
      background: use(my-bg-color);
      background: use(my-super-cool-bg, unsupported-feature(...));
  }
The second declaration of the 'background' property will probably be discarded by the user agent because it doesn't understand the 'unsupported-feature()' function. In this case, the background will use the 'my-bg-color' custom property value. The specification covers more complete rules for this that handles more complex cases.
Received on Thursday, 6 September 2012 09:45:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:59 GMT