Re: [variables] invalid variables

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 UTC