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

Re: [CSS-Variables] Suggestion of change to time of substitution

From: Tom Potts <karaken12@gmail.com>
Date: Fri, 16 Nov 2012 07:55:16 +0000
Message-ID: <CAF2aeH29F3PT74WFU5V5a_QFzb+rUKF=EtnL+3BtOoUj=QKNGg@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: CSS WG <www-style@w3.org>, François REMY <francois.remy.dev@outlook.com>
(Sorry for the late reply -- work getting in the way!)
Yes, the main problem I was having was whether a value of "inherit" on a
custom property means that that property is inherited (i.e. the same as if
no declaration had been made) or if the "inherit" keyword was passed on
through property references. Either would make sense, but there are some
implications either way that need to be resolved.

As to which way makes more sense, I was worried about situations like this:
   p { color: var(mycolor); border-color: var(mycolor); }
in which I would expect every paragraph to have the same colour and border
colour. However, if "inherit" is passed through property references, it's
easy to construct a situation where this does not happen:
   <div style="color: red; border-color: blue;">
     <p style="var-mycolor: inherit;"> xxx <p>
   </div>

After some thought, I think I agree with François: inherit should be passed
through property references. While I don't like situations like the above
(I think they're unintuitive for authors), it would be more restrictive to
not allow "inherit" as a passable value, and any other way of passing it
(like, say, quoting the keyword, or escaping it in some other way) would be
at least as unintuitive. And if, for some reason, you really want
to explicitly specify that a custom property is inherited, you can use the
(L2) parent-property references.

The problem with that that I tried to bring up (yes, it was a bit of a
rambling message, and this one is threatening to be the same...) is that
"inherit" cannot be just inserted into the token stream any time after the
specified value -- inherit should be gone by the time we get to that
point. François gets around that by adding a "resolved value" step, which
is something I like the look of as it takes care of many of the things I
was worrying about with property references.

Does that make more sense? :o)

Cheers,
Tom

On 7 November 2012 21:47, François REMY <francois.remy.dev@outlook.com>wrote:

> |  they'll get substituted into other properties at
> |  computed-value time, when it's already too late to actually process
> |  them (they're processed in the transition from cascaded to specified
> |  value).
>
> This is why I changed the wording of my spec to say that reference
> resolution happens just after cascaded time. If you do so, the 'inherit'
> keyword get replaced just before the value computation and, actually, it
> will work as expetected.
>
> See http://fremycompany.com/TR/**2012/ED-css-custom/#value-**resolution<http://fremycompany.com/TR/2012/ED-css-custom/#value-resolution>
>
Received on Friday, 16 November 2012 07:55:43 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:02 GMT