W3C home > Mailing lists > Public > www-style@w3.org > October 2011

Re: Better Variables through Custom Properties

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 28 Oct 2011 09:14:52 -0700
Message-ID: <CAAWBYDByJ3aFj0nJ2JVK3SGhkOu7YH3faNnX-uawNv2aiR_88Q@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: www-style@w3.org
On Fri, Oct 28, 2011 at 8:50 AM, L. David Baron <dbaron@dbaron.org> wrote:
> On Friday 2011-10-28 00:08 -0700, Tab Atkins Jr. wrote:
>> I'm not entirely certain whether other types of values, such as 'em'
>> units, should resolve or not.  I suspect it's saner to resolve
>> everything that would normally be resolved at computed-value time.
> I don't see how you can resolve things like 'em' units.  For
> example, the following sets of declarations mean different things:
>  font-size: 2em; /* multiple of parent's font size */
>  width: 2em; /* multiple of element's font size */
>  color: currentColor; /* parent's color */
>  background-color: currentColor; /* element's color */
>  counter-reset: currentColor; /* identifier */
>  line-height: 100%; /* computed value is multiple of font-size */
>  vertical-align: 100%; /* computed value is multiple of line-height */
>  width: 100%; /* computed value is percentage */
> If you wanted to resolve things like these, you'd need to break them
> so that one of the above didn't work as authors would expect.
> Furthermore, if you wanted to resolve them at data-* computation
> time, you'd make data-* have dependencies on CSS properties, which
> makes the cyclic dependency detection substantially more
> complicated, since it would need to have an accurate representation
> of all of the dependencies between CSS properties (see [1]).  This
> cycle detection would in turn introduce compatibility problems that
> would prevent the working group from introducing new property
> dependencies in the future, since introducing a new CSS property
> dependency could turn data-* usage that was non-cyclic into
> something cyclic.

You're right.  Okay, so data properties only resolve their own
variables usage, nothing else.  The rest of the values are only
resolved when a variable is actually used in a property, because many
values requires that context before they can actually be resolved.

As well, I'd like to allow arbitrary functions and dimensions (since
data properties are useful for more than just variables), and having
to deal with some units resolving while others don't would be weird.

Received on Friday, 28 October 2011 16:15:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:51 UTC