[Bug 16517] New: CSS variables: Need a way to define a default value

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16517

           Summary: CSS variables: Need a way to define a default value
           Product: CSS
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Variables
        AssignedTo: jackalmage@gmail.com
        ReportedBy: rolandsteiner@chromium.org
         QAContact: public-css-bugzilla@w3.org


In the current CSS variables spec, AFAICT it is not possible to specify a
default value if a variable is not defined. For example, one cannot write:

p {
    background-color: black;
    background-color: var(user-bg-color);
}

to have the background color default of "black" be overwritten with the
contents of "var-user-bg-color", since the latter will always be selected, and
revert to invalid (i.e., transparent) rather than black if that variable is not
defined.

One way to allow this (IMHO essential) use case is to add a default-value
parameter to the var() function:

p {
    background-color: var(user-bg-color, black);
}

In this case, it should be allowed to nest var() functions, for multiple levels
of fall-back:

.menuitem {
    background-color: var(menu-item-bg, var(menu-bg, navy));
}

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 26 March 2012 05:47:05 UTC