Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

1171 lines (1143 sloc) 66.924 kb
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>CSS Custom Properties Module Level 2</title>
<link href="http://dev.w3.org/csswg/default.css" rel="stylesheet" type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel="stylesheet" type="text/css">
<style>
pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em }
pre.idl :link, pre.idl :visited { color:inherit; background:transparent }
i { font-style: normal; }
body {
background: white url('http://www.w3.org/StyleSheets/TR/logo-unofficial.png') fixed top left no-repeat;
max-width: 50em; margin-left: auto; margin-right: auto;
}
.hidden {
display: none;
}
.needWork {
color: #FF0000; background: yellow;
}
code.property, code.css { font-family: inherit !important; }
</style>
</head>
<body>
<div class="head">
<!--begin-logo-->
<!--end-logo-->
<h1>CSS Custom Properties and References Module Level 2</h1>
<h2 class="no-num no-toc" id="longstatus-date">Extensible Web CG's Draft
(2012-12-07)</h2>
<dl>
<dt>This version:
<!--<dd><a href="http://www.w3.org/TR/2012/WD-css-variables-20120614/">http://www.w3.org/TR/2012/ED-css-variables-20120614/</a>-->
</dt>
<dd><a href="http://fremycompany.com/TR/2012/ED-css-custom/">Extensible
CSS's unofficial draft</a> </dd>
<dt>Latest version: </dt>
<dd><a href="http://www.w3.org/TR/css-variables/">http://www.w3.org/TR/css-variables/</a>
</dd>
<dt>CSS WG's editors: </dt>
<dd class="vcard"><span class="fn">Luke Macpherson</span>, <span class="org">Google,
Inc.</span>, <span class="email">macpherson@google.com</span> </dd>
<dd class="vcard"> <a class="url" href="http://xanthir.com/contact/"> <span
class="fn">Tab Atkins Jr.</span>, </a> <span class="org">Google,
Inc.</span> </dd>
<dd class="vcard"> <span class="fn">Daniel Glazman</span>, <span class="org">Disruptive
Innovations</span>, <span class="email">daniel.glazman@disruptive-innovations.com</span>
</dd>
<dt>Extensible Web CG's editors: </dt>
<dd class="vcard"><span class="fn">François REMY</span>, Université
Libre de Bruxelles</dd>
<dd class="vcard"><span class="fn">Brian Kardell</span>, Apollo Group,
Inc.<br>
</dd>
</dl>
<!--begin-copyright-->
<!--end-copyright-->
<hr title="Separator for header"> </div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>CSS is a language for describing the rendering of structured documents
(such as HTML and XML) on screen, on paper, in speech, etc. This module
contains the features of CSS level 3 relating to custom properties. It
includes and extends the functionality of CSS level 2 <a href="#CSS21" rel="biblioentry">[CSS21]<!--{{!CSS21}}--></a>,
which builds on CSS level 1 <a href="#CSS1" rel="biblioentry">[CSS1]<!--{{CSS1}}--></a>.
<br>
</p>
<p>The main extensions of this spec to CSS level 2 are the introduction of <a
href="#token-stream-reference">references</a> as a new primitive value
type that is accepted by all properties, as well has a new family of
inherited properties called <a href="#custom-property">custom properties</a>
whose value can be any valid CSS token list.</p>
<p></p>
<h2 class="no-num no-toc" id="status">Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of a proposal draft. It is provided for discussion
only and may change at any moment. Its publication here does not imply
endorsement of its contents by W3C. Don't cite this document other than as
work in progress. </p>
<p>The (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bcss-variables%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a href="http://www.w3.org/Mail/Request">instructions</a>)
is preferred for discussion of this specification. When sending e-mail,
please put the text “css-custom” in the subject, preferably like this: “[<!---->css-custom<!---->]
<em>…summary of comment…</em>”.<br>
</p>
<!--end-status-->
<!--<p>The following features are at risk: …-->
<h2 class="no-num no-toc" id="contents">Table of contents</h2>
<!--begin-toc-->
<ul class="toc">
<li><a href="#intro"><span class="secno">1. </span> Introduction</a>
<ul class="toc">
<li><a href="#placement"><span class="secno">1.1. </span> Module
Interactions</a> </li>
<li><a href="#values"><span class="secno">1.2. </span> Values</a> </li>
</ul>
</li>
<li><a href="#definitions"><span class="secno">2. </span> Definitions</a>
<ul class="toc">
<li><a href="#token-stream"><span class="secno">2.1. </span> Token
stream</a></li>
<li><a href="#token-stream-reference"><span class="secno">2.2. </span>
Token stream reference</a></li>
<li><a href="#reference-types"><span class="secno">2.3. </span>Reference
Types<br>
</a></li>
<li><a href="#custom-property"><span class="secno">2.4. </span>Custom
property</a> </li>
<li><a href="#value-resolution"><span class="secno">2.5. </span>Expression
resolution algorithm</a><br>
</li>
<li><a href="#property-reference"><span class="secno">2.6. </span>
Property reference</a> </li>
</ul>
</li>
<li><a href="#referencing-token-streams"><span class="secno">3. </span>Syntax
and implementations</a>
<ul class="toc">
<li><a href="#ref-syntax"><span class="secno">3.1. </span>General
syntax of a reference</a> </li>
<li><a href="#references-as-a-value"><span class="secno">3.2. </span>References
a a value</a></li>
<li><a href="#invalid-ref-paths"><span class="secno">3.3. </span>Invalid
references</a> </li>
<li><a href="#get-ref"><span class="secno">3.4. </span>Direct
Property References</a> </li>
<li><a href="#parent-ref"><span class="secno">3.5. </span> Parent
Property References</a></li>
<li><a href="#document-property-references"><span class="secno">3.6. </span>
Document Property references</a> </li>
<li><a href="#attribute-references"><span class="secno">3.7. </span>Attribute
references</a> </li>
<li><a href="#counter-references"><span class="secno">3.8. </span>Counter
references</a> </li>
<li><a href="#using-invalid-references"><span class="secno">3.9. </span>
Using invalid references</a> </li>
</ul>
</li>
<li><a href="#cssom"><span class="secno">4. </span> CSSOM</a>
<ul class="toc">
<li><a href="#csstokenstreamreference-interface"><span class="secno">4.1.
</span> Interface <code>CSSTokenStreamReference</code></a> </li>
<li><a href="#cssstyledeclaration-interface"><span class="secno">4.2.
</span> Additions to the <code>CSSStyleDeclaration</code>
Interface</a> </li>
</ul>
</li>
<li><a href="#conformance"><span class="secno">5. </span> Conformance</a>
<ul class="toc">
<li><a href="#conventions"><span class="secno">5.1. </span> Document
Conventions</a> </li>
<li><a href="#conformance-classes"><span class="secno">5.2. </span>
Conformance Classes</a> </li>
<li><a href="#partial"><span class="secno">5.3. </span> Partial
Implementations</a> </li>
<li><a href="#experimental"><span class="secno">5.4. </span>
Experimental Implementations</a> </li>
<li><a href="#testing"><span class="secno">5.5. </span>Non-Experimental
Implementations</a> </li>
<li><a href="#cr-exit-criteria"><span class="secno">5.6. </span> CR
Exit Criteria</a> </li>
</ul>
</li>
<li class="no-num"><a href="#acknowledgments">Acknowledgments</a> </li>
<li class="no-num"><a href="#references">References</a>
<ul class="toc">
<li class="no-num"><a href="#normative-references">Normative
references</a> </li>
<li class="no-num"><a href="#other-references">Other references</a> </li>
</ul>
</li>
<li class="no-num"><a href="#index">Index</a> </li>
<li class="no-num"><a href="#property-index">Property index</a> </li>
</ul>
<!--end-toc-->
<h2 id="intro"><span class="secno">1. </span> Introduction</h2>
<p><em>This section is not normative.</em> </p>
<p>Modern documents and applications contain a significant amount of styling
information, often spread across numerous related stylesheets.&nbsp; By
their nature, they describe important implicit design relationships.&nbsp;
For example, most authors design a palette consisting of a small number of
colors and font treatments which are used repeatedly in numerous
locations, targeting disparate pieces of the styled document. Today, the
intended link between those values is often lost as values are repeated,
making altering this data difficult and error-prone. </p>
<p>Each of these related values, in concept, points to a single virtual CSS
value. Until now, however, the link between them has never materialized in
expressive terms. One of the goals of this module is to make factual this
link by introducing the concept of reference in CSS.</p>
<p>To accomplish those goals, this module introduces a new family of
properties known collectively as <a href="#custom-property"><i>custom
properties</i></a>, which allow an author to assign arbitrary values
to properties with an author-chosen name. This module also introduces <a
href="#token-stream-reference"><i>property references</i></a>, a
mechanism which allows an author to reuse the value of those properties
into other CSS properties.&nbsp;</p>
<p>Thus, what were previously arbitrary-seeming values (like #cfcfff) may
now have informative names (like x-primary-color). This makes authoring
and editing stylesheets much easier and less error-prone, as a single
value modification at the custom property declaration site will
automatically propagate to anywhere that property is referenced. </p>
<div class="example">
<p><a id="sample-global">The example below</a> demonstrates how custom
properties and property references allow the author to adapt the design
of websites easily. Imagine the common case in which a website has a
variant color scheme depending on the section, but otherwise share a
common layout (as illustrated by the following pictures):</p>
<p align="center"><img alt="[RED WEBSITE]" src="./site-color-scheme-red.jpg">
&nbsp;&nbsp; <img alt="[GREEN WEBSITE]" src="./site-color-scheme-green.jpg">
&nbsp;&nbsp; <img alt="[BLUE WEBSITE]" src="./site-color-scheme-blue.jpg"></p>
<p>Custom properties and references allow the author to express these
relationships variably and thus efficiently manage the CSS:</p>
<pre><strong>/* red color scheme (default) */</strong><br>@document url-prefix("http://example.com/") {<br> html {<br> &nbsp;x-dark-color: #770000;<br> &nbsp;x-light-color: #ffdddd;<br> &nbsp;x-color: #eebbbb;<br> &nbsp;}<br>}<br><br><strong>/* green color scheme */</strong><br>@document url-prefix("http://example.com/green-section") {<br> html {<br> &nbsp;x-dark-color: #007700;<br> &nbsp;x-light-color: #ddffdd;<br> &nbsp;x-color: #bbeebb;<br> &nbsp;}<br>}<br><br><strong>/* blue color scheme */</strong><br>@document url-prefix("http://example.com/blue-section") {<br> html { <br> x-dark-color: #000077; <br> x-light-color: #ddddff; <br> x-color: #bbbbee;<br> }<br>}<br><br><strong>/* website styling */</strong><br>header { background-color: get(x-dark-color); }<br>nav { background-color: get(x-light-color); }<br>nav .selected { background-color: get(x-color); }<br>h1 { color: get(x-dark-color); }<br>…<br></pre>
</div>
<p>Additionally, this module aims to provide a way for authors to dispatch
custom styling information to their custom components in a way that does
not interfere with browser-provided properties.</p>
<p>This design also brings a new tool for Web authors to shim unimplemented
CSS properties in a forward compatible manner by guaranteeing that new
native implementations will never overlap with their own implementation. </p>
<div class="example">
<p><a id="sample-local">The example below</a> illustrates how authors can
use custom properties and property references to shim properties on
their own HTML components:</p>
<pre>&lt;style&gt;<br> .no-toolbar { x-toolbar-display: none }<br>&lt;/style&gt;<br><br>&lt;x-property-editor <br> data-for="document.body"<br> class="no-toolbar" <br>/&gt;<br></pre>
<p>In the shadow tree style of the <code>&lt;x-property-editor&gt;</code>
element, the following CSS could be used:</p>
<pre>#toolbar { display: get(x-toolbar-display); }</pre>
<p> This works because custom properties are inherited across the shadow
tree boundaries.</p>
</div>
<div class="example">
<p>The example below, extracted from an hypothetical Christmas animation,
illustrates how authors can use custom properties to represent
meta-information and affect several other properties :</p>
<pre>.snow<br>{<br> background: url(snowflake.svg);
<br> width: calc(5px * get(x-radius));
height: calc(5px * get(x-radius));<br> <br> animation:<br> &nbsp;fallOnTheGround 15s infinite;<br> animation-duration:<br> calc(15s * get(x-weight));<br> x-horizontal-bouncing:<br> calc(5px / get(x-radius) / get(x-radius));<br>}<br><br>.small.snow { x-radius: 0.9; }<br>.snow { x-radius: 1.0; }<br>.big.snow { x-radius: 1.5; }<br></pre>
</div>
<h3 id="placement"><span class="secno">1.1. </span> Module Interactions</h3>
<p>This module defines a new type of primitive value, the <a href="#token-stream-reference"><i>token
stream reference</i></a>, which is accepted in all CSS expressions,
anywhere one or more tokens are required or accepted. </p>
<h3 id="values"><span class="secno">1.2. </span> Values</h3>
<p>This specification follows the <a href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS
property definition conventions</a> from <a href="#CSS21" rel="biblioentry">[CSS21]<!--{{!CSS21}}--></a>.
Value types not defined in this specification are defined in CSS Level 2
Revision 1 <a href="#CSS21" rel="biblioentry">[CSS21]<!--{{!CSS21}}--></a>.
Other CSS modules may expand the definitions of these value types: for
example <a href="#CSS3COLOR" rel="biblioentry">[CSS3COLOR]<!--{{CSS3COLOR}}--></a>,
when combined with this module, expands the definition of the
&lt;color&gt; value type as used in this specification. </p>
<h2 id="definitions"><span class="secno">2. </span> Definitions</h2>
<h3 id="token-stream"><span class="secno">2.1. </span> Token stream</h3>
<p>A <dfn>token stream</dfn> is a dynamic list of CSS tokens, as defined in
the <a href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS2.1
Chapter 4</a> specification (<em>or in the CSS Syntax specification <a
href="#CSS3-SYNTAX" rel="biblioentry">[CSS3-SYNTAX]<!--{{!CSS3-SYNTAX}}--></a>
as soon as it will reach the W3C Recommendation status</em>). <br>
</p>
<p>To be valid, a token stream must conform to the <a href="#value-type">&lt;value&gt;</a>
type (a token stream which doesn't conform is called an <a href="#invalid-token-stream">invalid
token stream</a>). <br>
</p>
<div class="note">
<p>Given the <a href="#value-type">&lt;value&gt;</a> type definition, an
empty token stream represents an <a href="#invalid-token-stream">invalid
token stream</a>.</p>
</div>
<h3 id="token-stream-reference"><span class="secno">2.2. </span> Token
stream reference</h3>
<p>A <dfn>token stream reference</dfn> (also simply called <dfn>reference</dfn>)
is a set of CSS tokens used in a value expression to reference a <a href="#token-stream">token
stream</a> called the <dfn id="provided-value">provided value</dfn>. <br>
</p>
<p>Optionally, a reference can provide a second token stream called the <dfn
id="fallback-value">fallback value</dfn> for the cases where the
referenced token stream is invalid. When no fallback value is provided,
the fallback value is invalid.<br>
</p>
<p>The <dfn>final value</dfn> of a reference is either equal to its
provided value (if it's valid) or its fallback value (otherwise),
eventually after a type conversion (see next section). The final value of
a reference must be invalid if both its provided and its fallback value
are invalid.</p>
<p>An expression is invalid if contains any reference whose final value is
invalid.</p>
<p class="note">The exact syntax and the set of conditions in which a
reference can be used are defined in the <a href="#referencing-token-streams">Chapter
3</a> of this specification. </p>
<h3 id="reference-types"><span class="secno">2.3. </span>Reference types<br>
</h3>
<p></p>
<p>A reference can also provide a particular <dfn>reference type </dfn>which
will effectively constrain the set of values it will accept by providing a
value converter.&nbsp;</p>
<p>The <dfn id="reference-type-type"><var>&lt;reference-type&gt;</var></dfn>
type match any of the following identifiers (‘<code class="property">value</code>’,
‘<code class="property">color</code>’, ‘<code class="property">length</code>’,
‘<code class="property">number</code>’, ‘<code class="property">integer</code>’,
‘<code class="property">angle</code>’, ‘<code class="property">time</code>’,
‘<code class="property">frequency</code>’ or the name of any type defined
in a CSS specification). When those values are used, the provided and the
fallback value must be valid representations of the type of the given name
to be recognized. No conversion is performed to compute the final value,
assuming it's valid.<br>
</p>
<p>The <dfn id="reference-type-type"><var>&lt;reference-type&gt;</var></dfn>
type also match any of the following identifiers (‘<code class="property">px</code>’,
‘<code class="property">em</code>’, ‘<code class="property">vw</code>’, ‘<code
class="property">rad</code>’, ‘<code class="property">s</code>’, ‘<code
class="property">Hz</code>’, ‘<code class="property">dpi</code>’ or the
name of any unit defined in a CSS specification). When those values are
used, the provided and the fallback value must be valid numbers to be
recognized. The final value is defined as a dimension whose value is given
by the uncomputed final value and whose unit is given by the reference
type.<br>
</p>
<p>A value is <dfn>valid according to a reference type</dfn> if it's
recognized by the value converter defined for this type.</p>
<h3 id="custom-property"><span class="secno">2.4. </span> Custom property</h3>
<p> This specification defines an open-ended set of properties called <a href="#custom-property"><i>custom
properties</i></a>. Custom properties are author-defined properties
which do not have any direct impact on the document rendering or behavior
but can be used indirectly (by reference) as values in other CSS
properties.</p>
<table class="propdef">
<tbody>
<tr>
<th>Name: </th>
<td><dfn id="my-properties">x-*</dfn> </td>
</tr>
<tr>
<th>Values: </th>
<td><a href="#value-type"><var>&lt;value&gt;</var></a> </td>
</tr>
<tr>
<th>Initial: </th>
<td>(an empty token stream, see prose) </td>
</tr>
<tr>
<th>Applies To: </th>
<td>all elements </td>
</tr>
<tr>
<th>Inherited: </th>
<td>yes </td>
</tr>
<tr>
<th>Computed Value: </th>
<td>strictly equal to the resolved value (CSS-wide keywords aren't
replaced)<br>
</td>
</tr>
<tr>
<th>Media: </th>
<td>all </td>
</tr>
</tbody>
</table>
<p>The <dfn id="value-type"><var>&lt;value&gt;</var></dfn> type used in the
syntax above is defined as anything matching the "value" production in <a
href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS 2.1
Chapter 4.1</a> <a href="#CSS21" rel="biblioentry">[CSS21]<!--{{!CSS21}}--></a>.
<br>
</p>
<p>This puts only a few restrictions on what kinds of values you can store
in custom properties. Obviously, any valid property value or component of
a property is allowed. Additionally, it allows things that are not yet
valid CSS values, like unknown keywords or functions, blocks, at-rules,
and other kinds of custom micro-syntax (for example, what is allowed in
calc()). <br>
</p>
<p>Still, as the production has to be valid CSS, some restrictions apply. </p>
<p class="note">For example, unbalanced parentheses are always invalid. </p>
<p>The term <dfn id="custom-property" title="custom property|custom properties">custom
property</dfn> refers to any property whose name is composed of a "x-"
prefix followed by something matching the IDENT production in <a href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS2.1
Chapter 4</a>. </p>
<p>The <b>initial value</b> of a <a href="#custom-property"><i>custom
property</i></a> is empty (doesn't contain any token). This means
that, until a <a href="#custom-property"><i>custom property</i></a> is
explicitly defined in a stylesheet of the document, it defines an <a href="#invalid-token-stream"><i>invalid
token stream</i></a>.</p>
<p><a href="#custom-property"><i>Custom properties</i></a> are defined to be
valid but meaningless as they are meant solely for allowing authors to
define and use custom styling data, similarly to how the <a href="http://www.w3.org/TR/html5/global-attributes.html#embedding-custom-non-visible-data-with-the-data-attributes">custom
data attributes</a> are used in HTML. Other specifications and user
agents must not assign a particular meaning to <a href="#custom-property"><i>custom
properties</i></a> or attach a specific effect to them beyond the bare
minimum that comes from them being valid properties. </p>
<div class="example">
<p> This style rule: </p>
<pre>:root {
x-header-color: #06c;
}</pre>
<p>declares a <a href="#custom-property"><i>custom property</i></a> named
"x-header-color" on the root element, and assigns to it the value
"#06c". This property is then inherited to the elements in the rest of
the document. Its value can be referenced via an appropriate: </p>
<pre>h1 { color: get(x-header-color); }</pre>
<p>The preceding rule is equivalent to writing ‘<code class="css">color:
#06c;</code>’, except that the name makes the origin of the color
clearer, and if ‘<code class="css">get(x-header-color)</code>’ is used
on other elements in the document, all of the uses can be updated at
once by changing the ‘<code class="property">x-header-color</code>’
property on the root element (since all are descendants of :root). </p>
<p>This change can happen after the document is already loaded, for
example in reaction to a media query change, as the user selects an
alternate style sheet or as a result of an action performed in script. </p>
</div>
<p>Custom properties are ordinary properties, so they can be declared on any
element and are resolved with the normal inheritance and cascade rules.
They can also be used in HTML's <code>style</code> attribute and be read
or modified using the usual CSSOM methods. </p>
<div class="example">
<p>If a <a href="#custom-property"><i>custom property</i></a> is declared
multiple times, the standard cascade rules help resolve it. Property
references always draw from the computed value of the associated custom
property on the same element: </p>
<pre>:root { x-color: blue; }
div { x-color: green; }
#alert { x-color: red; }<br>* { color: get(x-color); }
&lt;p&gt;I inherited blue from the root element!&lt;/p&gt;
&lt;div&gt;I got green set directly on me!&lt;/div&gt;
&lt;div id='alert'&gt;
While I got red set directly on me!
&lt;p&gt;I'm red too, because of inheritance!&lt;/p&gt;
&lt;/div&gt;</pre>
</div>
<h3 id="value-resolution"><span class="secno">2.5. </span>Expression
resolution algorithm<br>
</h3>
<p>Just before an expression is being computed (<em>just after the cascade
phase in the case of property value expressions</em>), the references it
contains must be resolved. <br>
</p>
<p>The value of a property after this phase is called the <dfn>resolved
value</dfn>.<br>
</p>
<p class="note"> It is important to note that <a href="#custom-property"><i>custom
properties</i></a> resolve any <a href="#token-stream-reference"><i>token
stream reference</i></a> their value before the computed-value time.
As such, an inherited value doesn't contain any reference.<br>
</p>
<p>Resolving an expression is the process of substituting the references it
contains by their final value, and continuing until the resulting
expression doesn't contain any reference. <br>
</p>
<p>It's to be noted that the provided value of a reference must be invalid
if computing its provided value would cause the resolution algorithm to
enter in a loop (its fallback value must be used instead). This behavior
is known as the cyclic dependency resolution.</p>
<p>In general, cyclic dependencies occur only when multiple custom
properties on the same element refer to each other; custom properties
defined on elements higher in the element tree can never cause a cyclic
reference with properties defined on elements lower in the element tree. </p>
<p></p>
<p><a href="#custom-property"></a></p>
<p class="note">A JavaScript implementation of this algorithm can be found
on the <a href="http://lists.w3.org/Archives/Public/www-style/2012Oct/0599.html">www-style
mailing list</a>.</p>
<div class="example">
<p>This example shows a custom property safely using a property reference:
</p>
<pre>:root {
x-main-color: #c06;
x-accent-background: linear-gradient(to top, get(x-main-color), white);
}</pre>
<p>The ‘<code class="property">x-accent-background</code>’ property (along
with any other properties that directly or indirectly references ‘<code
class="css">x-main-color</code>’) will be automatically updated when
the ‘<code class="property">x-main-color</code>’ property is changed. </p>
</div>
<div class="example invalid-example">
<p>On the other hand, this example shows an invalid instance of custom
properties depending on each other: </p>
<pre>:root {
x-a: calc(get(x-b) + 20px);
x-b: calc(get(x-a) - 20px);
}</pre>
<p>Both ‘<code class="property">x-one</code>’ and ‘<code class="property">x-two</code>’
now define <a href="#invalid-token-stream"><i>invalid token streams</i></a>
rather than lengths. </p>
</div>
<div class="example">
<p>For example, given the following structure, these custom properties are
<strong>not</strong> cyclic, and all define valid token streams: </p>
<pre>&lt;one&gt;&lt;two&gt;&lt;three /&gt;&lt;/two&gt;&lt;/one&gt;
one { x-foo: 10px; }
two { x-bar: calc(get(x-foo) + 10px); }
three { x-foo: calc(get(x-bar) + 10px); }</pre>
<p>The &lt;one&gt; element defines a value for ‘<code class="property">x-foo</code>’.
<br></p>
<p>The &lt;two&gt; element inherits this value, and additionally assigns a
value to ‘<code class="property">x-bar</code>’ by referencing
&lt;one&gt;'s ‘<code class="css">x-foo</code>’ property. <br>
</p>
<p>Finally, the &lt;three&gt; element inherits the ‘<code class="property">x-bar</code>’
value <em>after</em> token stream substitution (in other words, it sees
the value ‘<code class="css">calc(10px + 10px)</code>’), and then
redefines ‘<code class="property">x-foo</code>’ in terms of that value.
<br>
</p>
<p>Since the value it inherited for ‘<code class="property">x-bar</code>’
no longer contains a reference to the ‘<code class="property">x-foo</code>’
property defined on &lt;one&gt;, defining ‘<code class="property">x-foo</code>’
using ‘<code class="css">get(x-bar)</code>’ is not cyclic, and actually
defines a value that will eventually (when referenced as a token stream
in a normal property) resolve to ‘<code class="css">30px</code>’. <br>
</p>
</div>
<div class="example invalid-example">
<p>This example shows how fallback value help resolve cyclic dependencies:
</p>
<pre>:root {
x-a: get(x-b || 0px);
x-b: get(x-a);
}</pre>
<p>Both ‘<code class="property">x-one</code>’ and ‘<code class="property">x-two</code>’
now have 0px as their computed value. </p>
</div>
<div class="example invalid-example">
<p>This example shows how over-constrained fallback values help resolve
cyclic dependencies: </p>
<pre>:root {
x-a: get(x-b || 0px);
x-b: get(x-a || 1px);
}</pre>
The ‘<code class="property">x-one</code>’ property computes to 1px and ‘<code
class="property">x-two</code>’ to 0px. The fallback value which is
located the closest to the cyclic dependency initiator is actually the one
that get used, hence the 'inversion'.<br>
<p></p>
</div>
<p>Authors should not depend on the cyclic dependencies and their resolution
in their style sheets if there's an alternative way to get the same result
that doesn't trigger this algorithm.<br>
</p>
<span class="secno"></span>
<h3 id="property-reference"><span class="secno">2.6. </span> Property
reference<br>
</h3>
<p>A <strong>property reference</strong> is a reference whose provided
value depends on the value of a <a href="#custom-property"><i>custom
property</i></a> located on an element or pseudo-element of the styled
document. <br>
</p>
<div class="issue">
<p>The CSS Custom Properties editors would like to lift the 'custom
property' restriction here.</p>
<p>This is the reason why we require the 'x-' prefix to be typed in the
property references defined in this specification. Otherwise, it would
make inconsistent of difficult its extension to all properties.<br>
</p>
</div>
<p> </p>
<p>If the referenced property doesn't exists, the provided value of the
property reference is invalid.<br>
</p>
<p>How the property is referenced, on which element it is referenced and
which value is going to be used has to be defined for each type of
property reference.<br>
</p>
<p></p>
<!-- USING -->
<h2 id="referencing-token-streams"><span class="secno">3. </span>Syntax and
implementations<br>
</h2>
<h3 id="ref-syntax"><span class="secno">3.1. </span>General syntax of a
reference</h3>
<p>When used as or in a value production, some functional notations
represent a token stream reference. The general syntax of a <a href="#token-stream-reference">reference</a>
is the following one : </p>
<pre><dfn id="ref-type">&lt;ref&gt;</dfn> = "get" ( <var>&lt;reference-path&gt;</var> [ "|" &lt;<var>reference-type</var>&gt; [ "|" <a
href="#value-type"><var>&lt;value&gt;</var></a> ]? ]? )</pre>
<p> ...where <var>&lt;reference-path&gt;</var> represent anything matching
the <dfn>IDENT+</dfn> production in <a href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS2.1
Chapter 4</a>. </p>
<p>The second (and optional) argument of the function is its type
declaration.<br>
</p>
<p>The third (and optional) argument of the function is its <a href="#fallback-value">fallback
value</a>.</p>
<div class="example">
<p>In this informative example, the syntax of an hypothetical token stream
reference is explained. </p>
<pre>p { property: get( foo bar || fallback value ); }</pre>
<p>The '<code class="css">foo</code>' token represents the provider of the
reference.<br>
The '<code class="css">bar</code>' token represents the name of the
referenced token stream.<br>
The '<code class="css">fallback value</code>' tokens represent the
fallback token stream of the reference.</p>
<p>If the referenced token stream contained the '<code>value</code>'
token, the previous declaration is equivalent to: </p>
<pre>p { property: value; }<br></pre>
<p>If the referenced token stream is invalid, the previous declaration is
equivalent to:</p>
<pre>p { property: fallback value; }</pre>
</div>
<p>At resolution time, token stream references are substituted for their
final value if it is invalid (otherwise, the declaration is marked invalid
at resolution time).</p>
<h3 id="references-as-a-value"><span class="secno">3.2. </span>References
as a value<br>
</h3>
<p></p>
<p>A reference can be used as a substitute to any part of a value, in any
expression, to the condition that the resulting expression is valid at
declaration time according to the rules defined beneath:<br>
</p>
<p class="note">This specification doesn't define a way to use references
anywhere else. An UA conforming to this specification and CSS 2.1 should
not accept token stream references in property names, selectors, or
anywhere else besides property values and media queries arguments - doing
so either produces either an invalid value or a valid value that
nonetheless has no relation to the reference. <br>
</p>
<p>If the fallback value of a reference is not a valid instance of its
reference type, the declaration that contains the reference is invalid at
declaration time (and should therefore be ignored).</p>
<div class="example">
<p>For example, the following usage of a <a href="#property-reference">property
reference</a> is fine from when the token stream reference is
substituted in but invalid at declaration time : </p>
<pre>:root { x-color: blue; }
p { background-color: get(x-color | color | 20px); }</pre>
<p>Since the fallback value (‘<code class="css">20px</code>’) is not a
valid color, the previous declaration is ignored.<br>
</p>
</div>
<p></p>
<p>An expression containing references is also invalid at declaration time
if, when all references it contains providing a fallback value have been
replaced by their fallback value, it's impossible to find any valid value
for the remaining references that can make the resulting expression valid
where it is used.</p>
<div class="example">
<p>Given the following CSS file, a conforming user agent should display
each matching DIV element with a <b>white</b> text over a <b>green </b>background.</p>
<pre>div {<br> x-background-color: green;<br> x-foreground-color: white;<br> x-secondary-color: red;<br> <br> color: get(x-foreground-color); // valid<br> color: get(x-secondary-color || 10px); // invalid<br> <br> background-color: yellow; // valid (overridden)<br> background-color: get(x-background-color || blue); // valid<br> <br> outline-color: get(x-a) get(x-b); // invalid (&lt;color&gt; has one token)<br>}</pre>
</div>
<p></p>
<div class="note">
<p>The rationale behind this restriction is to allow proper fallback for
unsupported features.</p>
<pre>.selector {<br> background: get(x-bg-color);<br> background: get(x-super-cool-bg || unsupported-feature(...));<br>}<br></pre>
<p>The second declaration of the '<span class="css">background</span>'
property will probably be discarded by the user agent because it doesn't
understand the '<span class="css">unsupported-feature()</span>'
function. In this case, the background will use the '<span class="css">x-bg-color</span>'
custom property value. </p>
</div>
<p></p>
<p>If a syntactically valid expression becomes invalid once all references
are substituted in by their final value, then the expression is said <a href="#invalid-at-computed-value-time"><i>invalid
at resolution time</i></a>.&nbsp;</p>
<div class="example">
<p>For example, the following usage of a <a href="#property-reference">property
reference</a> is fine from a syntax standpoint, but results in
nonsense when the token stream reference is substituted in: </p>
<pre>:root { x-length: 20px; }
p { background-color: get(x-length); }</pre>
<p>Since ‘<code class="css">20px</code>’ is an invalid value for ‘<code class="property">background-color</code>’,
this instance of the property computes to ‘<code class="property">transparent</code>’
(the initial value for ‘<code class="property">background-color</code>’)
instead. </p>
</div>
<h3 id="invalid-ref-paths"><span class="secno">3.3. </span>Invalid
References</h3>
<p>The ‘<code class="css">get()</code>’ functional notation is an instance
of reference if its <em>reference path</em> contains only one identifier,
and that this identifier is ‘<code class="css">invalid</code>’, or if the
reference path doesn't match any supported reference path format. <br>
</p>
<p>The <a href="#provided-value">provided value</a> of the invalid
reference is empty and invalid.</p>
<h3 id="get-ref"><span class="secno">3.4. </span>Direct Property References</h3>
<p>The ‘<code class="css">get()</code>’ functional notation is an instance
of property reference if its <em>reference path</em> contains only one
identifier, and that this identifier is not ‘<code class="css">invalid</code>’.</p>
<p>The <a href="#property-references">referenced property</a> of the ‘<code
class="css">get(</code><code class="css">property</code><code class="css">)</code>’
notation is the property applied on the matched element whose name match
the last token of its reference path. <br>
</p>
<p>The <a href="#provided-value">provided value</a> of the ‘<code class="css">get(</code><code
class="css">property</code><code class="css">)</code>’ notation is
either the cascaded value of the referenced property if is is declared on
the element, or its inherited/initial value otherwise (depending of
whether that property was inherited or not). <br>
</p>
<p></p>
<p class="note">Properties whose value is inherited are also valid target,
even if they are not specifically applying on the element. Without this,
custom properties would not be useful.<br>
</p>
<div class="example">
<p> For example, the following code defines and references a custom
property named "x-main-color". </p>
<pre>:root {
x-main-color: blue;
}
h1 {
color: get(x-main-color);
}<br></pre>
</div>
<div class="issue">
<p>Shouldn't we add a <code class="css">get(local x-property)</code>
notation that would only be valid if the property is explicitly declared
on the element, and would not take in consideration the
inherited/initial value?</p>
<p>This could be useful for using some custom properties as if they were
'non-inherited'. The other option is to ask developers to declare <code
class="css">* { x-property: get(invalid); }</code> in their stylesheet
to emulate the behavior the x-property would have if it was
'non-inherited'.<br>
<span class="secno"></span></p>
</div>
<h3 id="parent-ref"><span class="secno">3.5. </span> Parent Property
References<br>
</h3>
<p>Several advanced use-cases for custom properties need the ability to
reference the value that a property has on the parent element, rather than
on the element itself. This can be accomplished with the ‘<code class="css">get(parent
property)</code>’ notation. <br>
</p>
<div class="note">
<p>It's to be noted that</p>
<pre>property: get(parent property)<br></pre>
<p>and</p>
<pre>property: inherit<br></pre>
<p>are functionally identical.<br>
</p>
<pre></pre>
</div>
<p>The ‘<code class="css">get()</code>’ functional notation is an instance
of property reference if its reference path contains two tokens whose
first one is '<code class="css">parent</code>'.&nbsp;</p>
<p>The <a href="#property-references">referenced property</a> of the ‘<code
class="css">get(parent property)</code>’ notation is the property
applied on the parent of the matched element whose name match the last
token of its reference path.<br>
</p>
<p>The <a href="#provided-value">provided value</a> of the ‘<code class="css">get(parent
property)</code>’ notation is the computed value of the referenced
property. </p>
<p></p>
<div class="example">
<p> <img style="float: right; border-radius: 3px;" alt="Nested comments feature another color"
src="./comments-toggle.png">For example, ‘<code class="css">get(parent
...)</code>’ can be used to implement a behavior that's very similar
to the ‘<code class="css">toggle()</code>’ notation from [[CSS3VALUES]].
</p>
<p>In this example, each nested comment alternates between a white and
silver background (as in the picture floating to the right). <br>
</p>
<pre>&lt;div class='comment'&gt;
&lt;div class='main'&gt;
...
&lt;/div&gt;
&lt;div class='actions'&gt;&lt;a&gt;Reply&lt;/a&gt; &lt;a&gt;Comment&lt;/a&gt; ...&lt;/div&gt;
&lt;/div&gt;
&lt;div class='comment'&gt;
&lt;div class='main'&gt;
&lt;div class='comment'&gt;
&lt;div class='main'&gt;
...
&lt;/div&gt;
&lt;div class='actions'&gt;&lt;a&gt;Reply&lt;/a&gt; &lt;a&gt;Comment&lt;/a&gt; ...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class='actions'&gt;&lt;a&gt;reply&lt;/a&gt; &lt;a&gt;Comment&lt;/a&gt; ...&lt;/div&gt;
&lt;/div&gt;
&lt;style&gt;<br>
.comment {
x-bg1: get(parent x-bg2, white);
x-bg2: get(parent x-bg1, silver);
background: get(x-bg1);
}<br>
&lt;/style&gt;</pre>
<p> The ‘<code class="css">toggle()</code>’ notation can't be used here,
because ‘<code class="property">background-color</code>’ isn't inherited
(and thus the nested comments see the initial value of ‘<code class="css">transparent</code>’
rather than ‘<code class="css">white</code>’ or ‘<code class="css">silver</code>’).
Even if the author explicitly sets ‘<code class="css">background-color:inherit</code>’
on <code>&lt;div class='main'&gt;</code> so that ‘<code class="css">toggle()</code>’
can actually see the right value, that will make the ".main" elements
cover up the ‘<code class="property">background-image</code>’ that
".comment" has on it as well. </p>
<p>Because custom properties don't have any effect on rendering until
they're used, they can pass these values through the document without
these kinds of side effects. </p>
<p> The ‘<code class="css">get(property)</code>’ notation can't be used
here either as it would immediately produce a cycle between '<code class="css">x-bg</code>'
and '<code class="css">x-bg2</code>', making them both invalid. </p>
</div>
<h3 id="document-property-references"><span class="secno">37. </span>Document
Property references</h3>
<p id="document-property-references"><em>This section is not normative
(because it lacks any content for now).</em></p>
<p>The idea here is to allow to obtain some document properties like its
title or its URL to be used, for example, in the header and footer of
printed documents.</p>
<h3 id="attributes-references"><span class="secno">3.7. </span>Attribute
references</h3>
<p><em>This section is not normative (because it lacks any content for now).</em></p>
<p>The idea here is to replace the attribute references currently defined in
CSS Values and Units but not implemented by any user agent at the time of
writing.<br>
</p>
<h3 id="counter-references"><span class="secno">3.8. Counter </span>references<br>
</h3>
<p><em>This section is not normative (because it lacks any content for now).</em></p>
<p>The idea here is to allow to obtain the numeric value of a counter to be
used in calculations. There has been <a href="http://www.w3.org/mid/DUB120-DS54DF6D02A40C6650DCC56A5410@phx.gbl">some
discussion on the list</a> recently on the subject, and the result of
the discussion was that it's actually impossible to use counters to that
purpose (because counters depend on 'display: none'). However, it would
possible to define something like an 'indexer' to accomplish the same goal
(but an indexer would only rely on the DOM).</p>
<p></p>
<p></p>
<span class="secno"></span>
<h3 id="using-invalid-references"><span class="secno">3.9. </span> Using
invalid references</h3>
A property can become <dfn id="invalid-at-computed-value-time">invalid at
resolution time</dfn> if its resolved value is invalid according to the
property syntax. When this happens, the computed value of the property is
either the property's inherited value or its initial value depending on
whether the property is inherited or not, respectively.
<div class="example">
<p>For example, in the following code: </p>
<pre>:root { x-bad-color: 20px; }
p { background-color: red; }
p { background-color: get(x-bad-color); }</pre>
<p>the &lt;p&gt; elements will have transparent backgrounds (the initial
value for ‘<code class="property">background-color</code>’), rather than
red backgrounds.&nbsp; </p>
<p>Please note the difference between the present behavior and what
happens if the author had just written ‘<code class="css">background-color:
20px</code>’ directly in its stylesheet: that would be a normal syntax
error, which would cause the rule to be discarded. In that case, the ‘<code
class="css">background-color: red</code>’ rule would have been used
instead. </p>
</div>
<p class="note">The <a href="#invalid-at-computed-value-time"><i>invalid at
resolution time</i></a> concept exists because references can't "fail
early" like other syntax errors can. By the time the user agent realizes
that a property value is invalid, it already threw away the other cascaded
values. </p>
<h2 id="cssom"><span class="secno">4. </span> CSSOM</h2>
<p><a href="#custom-property"><i>Custom properties</i></a> are ordinary
properties, and can be read or modified using all of the existing CSSOM
APIs for reading or modifying properties. </p>
<p>The specification extends the IDL definitions in the CSSOM spec to
represent the use of the ‘<code class="css">get()</code>’ function. </p>
<h3 id="csstokenstreamreference-interface"><span class="secno">4.1. </span>
Interface CSSTokenStreamReference</h3>
<p>The CSSTokenStreamReference interface represents an use of property token
stream. </p>
<dl>
<dt>IDL Definition </dt>
<dd>
<pre class="idl">[NoInterfaceObject] interface CSSTokenStreamReference {
attribute DOMString referencePath; <br> attribute DOMString referenceType;
attribute DOMString fallbackValue;
readonly attribute DOMString providedValue;<br> readonly attribute DOMString finalValue;
}</pre>
</dd>
<dt>Attributes</dt>
<dd>
<dl>
<dt> <code>referencePath </code>of type <code>DOMString</code> </dt>
<dd>This attribute represents the first argument of the ‘<code class="css">get()</code>’
function. Changing this attribute changes the token stream being
referred to. If this property is set to a value that don't match the
&lt;reference-path&gt;, it is set to ‘<code class="css">invalid</code>’
instead.</dd>
<dt> <code>referenceType </code>of type <code>DOMString</code> </dt>
<dd>This attribute represents the second argument of the ‘<code class="css">get()</code>’
function. Changing this attribute changes the conversion algorithm
used to parse the value of the reference. If this property is set to
a value that don't match the &lt;reference-type&gt;, it is set to ‘<code
class="css">any</code>’ instead.<br>
</dd>
<dt><code>fallbackValue</code> of type <code>DOMString</code> </dt>
<dd>This attribute represents the second argument to the function.
Changing this attribute changes the <a href="token-stream-reference">fallback
value</a> used as a replacement of the provided value whenever it
is <a href="#invalid-token-stream">invalid</a>. If this property is
set to a value that don't match the &lt;value&gt; type, it is set to
an empty string instead.</dd>
<dt><code>providedValue</code> of type <code>DOMString</code>,
readonly </dt>
<dd>This attribute represents the value provided by the referenced
token stream. If the provided value is invalid at the time it's
retrieved, the value of this attribute must be <code>null</code>.</dd>
<dt><code>finalValue</code> of type <code>DOMString</code>, readonly
</dt>
<dd>This attribute represents the final value used as a substitution
for the reference. It's equal to the provided value unless it's
equal to null. In such case, if the fallback value is valid, it
should be returned instead. Otherwhise, the value of this attribute
must be <code>null</code>.</dd>
</dl>
</dd>
</dl>
<h3 id="cssstyledeclaration-interface"><span class="secno">4.2. </span>
Additions to the <code>CSSStyleDeclaration</code> Interface</h3>
<div class="issue">
<p> The set of custom properties is open-ended, so it is not clear how
best to represent this. Ideally, the CSSOM would expose the current set
of properties with a non-initial value and allow setting of arbitrary
properties. <br>
</p>
<p>The most natural way seems to be to set up a getter behavior on the
interface somehow that deals with custom properties as well as a 'x' map
that exposes the custom properties that aren't set to their initial
value. <br>
</p>
<pre>document.body.style.x.property === document.body.style['x-property']<br></pre>
</div>
<h2 id="conformance"><span class="secno">5. </span> Conformance</h2>
<h3 id="conventions"><span class="secno">5.1. </span> Document Conventions</h3>
<p>Conformance requirements are expressed with a combination of descriptive
assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”,
“REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”,
“MAY”, and “OPTIONAL” in the normative parts of this document are to be
interpreted as described in RFC 2119. However, for readability, these
words do not appear in all uppercase letters in this specification. </p>
<p>All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes. <a href="#RFC2119"
rel="biblioentry">[RFC2119]<!--{{!RFC2119}}--></a> </p>
<p>Examples in this specification are introduced with the words “for
example” or are set apart from the normative text with <code>class="example"</code>,
like this: </p>
<div class="example">
<p>This is an example of an informative example. </p>
</div>
<p>Informative notes begin with the word “Note” and are set apart from the
normative text with <code>class="note"</code>, like this: </p>
<p class="note">Note, this is an informative note. </p>
<h3 id="conformance-classes"><span class="secno">5.2. </span> Conformance
Classes</h3>
<p>Conformance to CSS Custom Properties is defined for three conformance
classes: </p>
<dl>
<dt><dfn id="style-sheet" title="style sheet!!as conformance class">style
sheet</dfn> </dt>
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
style sheet</a>. </dd>
<dt><dfn id="renderer">renderer</dfn> </dt>
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
that interprets the semantics of a style sheet and renders documents
that use them. </dd>
<dt><dfn id="authoring-tool">authoring tool</dfn> </dt>
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
that writes a style sheet. </dd>
</dl>
<p>A style sheet is conformant to CSS Custom Properties if all of its
declarations that use properties defined in this module have values that
are valid according to the generic CSS grammar and the individual grammars
of each property as given in this module. </p>
<p>A renderer is conformant to CSS Custom Properties if, in addition to
interpreting the style sheet as defined by the appropriate specifications,
it supports all the features defined by CSS Custom Properties by parsing
them correctly and rendering the document accordingly. However, the
inability of a UA to correctly render a document due to limitations of the
device does not make the UA non-conformant. (For example, a UA is not
required to render color on a monochrome monitor.) </p>
<p>An authoring tool is conformant to CSS Custom Properties Module if it
writes style sheets that are syntactically correct according to the
generic CSS grammar and the individual grammars of each feature in this
module, and meet all other conformance requirements of style sheets as
described in this module. </p>
<h3 id="partial"><span class="secno">5.3. </span> Partial Implementations</h3>
<p>So that authors can exploit the forward-compatible parsing rules to
assign fallback values, CSS renderers <strong>must</strong> treat as
invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
as appropriate</a>) any at-rules, properties, property values, keywords,
and other syntactic constructs for which they have no usable level of
support. In particular, user agents <strong>must not</strong> selectively
ignore unsupported component values and honor supported values in a single
multi-value property declaration: if any value is considered invalid (as
unsupported values must be), CSS requires that the entire declaration be
ignored. </p>
<h3 id="experimental"><span class="secno">5.4. </span> Experimental
Implementations</h3>
<p>To avoid clashes with future CSS features, the CSS2.1 specification
reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
syntax</a> for proprietary and experimental extensions to CSS. </p>
<p>Prior to a specification reaching the Candidate Recommendation stage in
the W3C process, all implementations of a CSS feature are considered
experimental. The CSS Working Group recommends that implementations use a
vendor-prefixed syntax for such features, including those in W3C Working
Drafts. This avoids incompatibilities with future changes in the draft. </p>
<h3 id="testing"><span class="secno">5.5. </span>Non-Experimental
Implementations</h3>
<p>Once a specification reaches the Candidate Recommendation stage,
non-experimental implementations are possible, and implementors should
release an unprefixed implementation of any CR-level feature they can
demonstrate to be correctly implemented according to spec. </p>
<p>To establish and maintain the interoperability of CSS across
implementations, the CSS Working Group requests that non-experimental CSS
renderers submit an implementation report (and, if necessary, the
testcases used for that implementation report) to the W3C before releasing
an unprefixed implementation of any CSS features. Testcases submitted to
W3C are subject to review and correction by the CSS Working Group. </p>
<p>Further information on submitting testcases and implementation reports
can be found from on the CSS Working Group's website at <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
Questions should be directed to the <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
mailing list. </p>
<h3 id="cr-exit-criteria"><span class="secno">5.6. </span> CR Exit Criteria</h3>
<p> For this specification to be advanced to Proposed Recommendation, there
must be at least two independent, interoperable implementations of each
feature. Each feature may be implemented by a different set of products,
there is no requirement that all features be implemented by a single
product. For the purposes of this criterion, we define the following
terms: </p>
<dl>
<dt>independent </dt>
<dd>each implementation must be developed by a different party and cannot
share, reuse, or derive from code used by another qualifying
implementation. Sections of code that have no bearing on the
implementation of this specification are exempt from this requirement. </dd>
<dt>interoperable </dt>
<dd>passing the respective test case(s) in the official CSS test suite,
or, if the implementation is not a Web browser, an equivalent test.
Every relevant test in the test suite should have an equivalent test
created if such a user agent (UA) is to be used to claim
interoperability. In addition if such a UA is to be used to claim
interoperability, then there must one or more additional UAs which can
also pass those equivalent tests in the same way for the purpose of
interoperability. The equivalent tests must be made publicly available
for the purposes of peer review. </dd>
<dt>implementation </dt>
<dd>a user agent which:
<ol class="inline">
<li>implements the specification. </li>
<li>is available to the general public. The implementation may be a
shipping product or other publicly available version (i.e., beta
version, preview release, or “nightly build”). Non-shipping product
releases must have implemented the feature(s) for a period of at
least one month in order to demonstrate stability. </li>
<li>is not experimental (i.e., a version specifically designed to pass
the test suite and is not intended for normal usage going forward).
</li>
</ol>
</dd>
</dl>
<p>The specification will remain Candidate Recommendation for at least six
months. </p>
<h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
<p>Thanks to Daniel Glazman and Dave Hyatt for writing the original
Variables draft in 2008. Thanks to many WG members for keeping the idea of
variables alive through the years. Thanks to Roland Steiner and Shane
Stephens for invaluable feedback and implementation experience.Thanks also
to all the persons who contributed to this draft via www-style or any
other mean.<br>
</p>
<h2 class="no-num" id="references">References</h2>
<h3 class="no-num" id="normative-references">Normative references</h3>
<!--begin-normative-->
<!-- Sorted by label -->
<dl class="bibliography">
<dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
<!----> </dt>
<dt id="CSS21">[CSS21] </dt>
<dd>Bert Bos; et al. <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607"><cite>Cascading
Style Sheets Level 2 Revision 1 (CSS 2.1) Specification.</cite></a>
7 June 2011. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607">http://www.w3.org/TR/2011/REC-CSS2-20110607</a>
</dd>
<!----> <dt id="RFC2119">[RFC2119] </dt>
<dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key
words for use in RFCs to Indicate Requirement Levels.</cite></a>
Internet RFC 2119. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
</dd>
<!---->
</dl>
<!--end-normative-->
<h3 class="no-num" id="other-references">Other references</h3>
<!--begin-informative-->
<!-- Sorted by label -->
<dl class="bibliography">
<dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
<!----> </dt>
<dt id="CSS1">[CSS1] </dt>
<dd>Håkon Wium Lie; Bert Bos. <a href="http://www.w3.org/TR/2008/REC-CSS1-20080411"><cite>Cascading
Style Sheets (CSS1) Level 1 Specification.</cite></a> 11 April 2008.
W3C Recommendation. URL: <a href="http://www.w3.org/TR/2008/REC-CSS1-20080411">http://www.w3.org/TR/2008/REC-CSS1-20080411</a>
</dd>
<!----> <dt id="CSS3-SYNTAX">[CSS3-SYNTAX] </dt>
<dd>L. David Baron. <a href="http://www.w3.org/TR/css3-syntax/"><cite>CSS
Syntax Module Level 3.</cite></a> 13 August 2003. W3C Working Draft.
URL: <a href="http://www.w3.org/TR/css3-syntax/">http://www.w3.org/TR/css3-syntax/</a>
</dd>
<!----> <dt id="CSS3COLOR">[CSS3COLOR] </dt>
<dd>Tantek Çelik; Chris Lilley; L. David Baron. <a href="http://www.w3.org/TR/2011/REC-css3-color-20110607"><cite>CSS
Color Module Level 3.</cite></a> 7 June 2011. W3C Recommendation.
URL: <a href="http://www.w3.org/TR/2011/REC-css3-color-20110607">http://www.w3.org/TR/2011/REC-css3-color-20110607</a>
</dd>
<!---->
</dl>
<!--end-informative-->
<h2 class="no-num" id="index">Index</h2>
<!--begin-index-->
<ul class="indexlist">
<li><em>generated by tool</em></li>
</ul>
<!--end-index-->
<h2 class="no-num" id="property-index">Property index</h2>
<!--begin-properties-->
<table class="proptable">
<thead>
<tr>
<th>Property </th>
<th>Values </th>
<th>Initial </th>
<th>Applies to </th>
<th>Inh. </th>
<th>Computed value </th>
<th>Media </th>
</tr>
</thead>
<tbody>
<tr>
<th><a class="property" href="#var-">x-*</a> </th>
<td>&lt;value&gt; </td>
<td>(nothing, see prose) </td>
<td>all elements </td>
<td>yes </td>
<td>strictly equal to the resolved value<br>
</td>
<td>all </td>
</tr>
</tbody>
</table>
<!--end-properties-->
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.