<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16517</bug_id>
          
          <creation_ts>2012-03-26 05:47:02 +0000</creation_ts>
          <short_desc>CSS variables: Need a way to define a default value</short_desc>
          <delta_ts>2012-07-16 18:41:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>Variables</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Roland Steiner">rolandsteiner</reporter>
          <assigned_to name="Tab Atkins Jr.">jackalmage</assigned_to>
          <cc>adrian.yanes</cc>
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66035</commentid>
    <comment_count>0</comment_count>
    <who name="Roland Steiner">rolandsteiner</who>
    <bug_when>2012-03-26 05:47:02 +0000</bug_when>
    <thetext>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 &quot;black&quot; be overwritten with the contents of &quot;var-user-bg-color&quot;, 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));
}</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>