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

Re: [variables] invalid variables

From: Roland Steiner <rolandsteiner@google.com>
Date: Sun, 6 Nov 2011 18:05:15 -0800
Message-ID: <CACFPSphGk3S7whdkJahWK8xu1dhDSbnCr=ULgZ8_iRwMa1om1w@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org
On Thu, Nov 3, 2011 at 12:22, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> Resetting to the "default", which I assume means either the initial or
> inherited value, rather than always using the initial value might be
> okay.  Always choosing 'initial' is simpler, though, and considering
> this is a failure mode that authors *shouldn't* be running into, I
> don't know if we need to care about it.
>

Actually, thinking a bit more about this issue: one of the main use cases
for components (at least) is to override a default style - e.g., overriding
the default color of a media panel. The default should be set on the root
of the component rather than the document's root. I.e., the following 3
approaches would work:

-) ignoring properties with invalid values:

.panel {
    color: #333;
    color: data(panel-color);
}

-) a default value on data():

.panel {
  color: data(panel-color, #333);
}

-) using the default rather than the initial value of a property if a
variable is invalid (although this requires an artificial wrapper element
in some cases):

<div style="color: #333">
    <div class="panel" style="color: data(panel-color)">

As I understand, a version of data() with a 2nd "default value" parameter
is quite a ways off, and ignoring property lines with invalid variable
values doesn't seem an option, so this leaves only the (least elegant) 3rd
approach with the default value the interim. OTOH, if a property with an
invalid property instead results in 'initial', then AFAICT this use-case
isn't possible at all, greatly diminishing the usefulness of variables for
components.


- Roland
Received on Monday, 7 November 2011 02:06:11 GMT

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