- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Wed, 19 Mar 2014 13:52:36 -0700
- To: www-style list <www-style@w3.org>
On Wed, Mar 12, 2014 at 8:38 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > I've been thinking. > > At the last f2f, I proposed custom MQs and pseudo-classes. To > distinguish them from CSS-defined ones, I mandated that they had to > start with (or perhaps just contain) an underscore character, because > this is a valid character that CSS is nevertheless never going to use > in language-defined names. > > This, while a little ugly, seems to do the job pretty well. > > Simultaneously, I'm wrestling with the fact that basically nobody > understands that one of the primary use-cases of Custom Properties is > to do CSS polyfills, where you write your own properties with a "var-" > prefix and interpret them with JS. This avoids the "have to re-parse > the whole stylesheet yourself, and woe unto you if it's cross-origin" > problem that today's CSS polyfills have. From what I can tell, it's > the "var-" prefix that's misleading everyone - it's *so* closely tied > to var(), mentally, that it prevents people from imagining any other > use. > > Given that "tie it to var()" was one of my explicit justifications for > sticking with the "var-" prefix, I'm very aware of how much I've > hoisted myself by my own petard. > > So, suggestion. Assuming that we're sticking with the underscore > thing for custom MQs/pseudo-classes/etc, I think we should move the > syntax of Custom Properties to "any ident starting with/containing an > underscore" as well. This'll tie the syntax more closely to the > *other* "custom" things, which hopefully will lead to it being more > obvious that this is literally a CUSTOM PROPERTY, not just a variable > definition. > > The var() syntax is unchanged - the argument just switches to being > literally the property name, rather than the property name minus the > prefix. > > I talked to heycam about this a few hours ago, and he said that > Firefox is ready to ship Variables Real Soon Now, but this is a minor > enough change that it can be swapped in real quick and not delay > shipping if we decide on it quickly. > > I've given myself a self-imposed deadline of until the next conf call > to decide on this; if we say nay, or just don't decide, I'll happily > stick with what's currently in the draft, and let Firefox ship with > it. However, I'd like to spend the next week deciding whether we > should change the spec on this or not. In the telcon today, we resolved to use a "--" prefix to indicate custom properties and other custom things. We discussed whether the prefix is maintained or dropped when referring to the custom property from a var() function, but didn't actually resolve. Discussion in the call leaned toward dropping the prefix, like I do currently with var-* properties, but some side discussion with Simon and Sylvain argued for using the full name, as there are confusing cases like "--0" or "----". So, while I understand the potential confusion caused by authors possibly thinking that var() can take any property name as an argument, I think it's overruled by the confusion over what needs to be escaped in various circumstances. Escaping rules are always very confusing to authors, so I'm going to go with "use the custom property name literally as the var() argument". ~TJ
Received on Wednesday, 19 March 2014 20:53:24 UTC