/
draft.html
1003 lines (983 loc) · 59.7 KB
/
draft.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>CSS Custom Properties Module Level 1</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-image: url('http://www.w3.org/StyleSheets/TR/logo-unofficial.png');
max-width: 60em; margin-left: auto; margin-right: auto;
}
.hidden {
display: none;
}
.needWork {
color: #FF0000; background: yellow;
}
</style>
</head>
<body>
<div class="head">
<!--begin-logo-->
<h1>CSS Custom Properties Module Level 1</h1>
<h2 class="no-num no-toc" id="longstatus-date">Proposal's Draft 18 June
2012</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/">Proposal's
draft</a> (version of 18 June 2012) </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>W3C 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>Proposal 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-->
<p class="hidden"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel="license">Copyright</a> © 2012 <a href="http://www.w3.org/"><abbr
title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr
title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr
title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--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>.
The main extensions compared to level 2 are the introduction of <a href="#tbd">token
stream</a> as a new primitive value type that is accepted by all
properties, as well has a new family of inherited properties called custom
properties whose value can be any valid CSS token list.</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-variables” in the subject, preferably like this:
“[<!---->css-variables<!---->] <em>…summary of comment…</em>” ” </p>
<p class="hidden">This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>). </p>
<p class="hidden">This document was produced by a group operating under the
<a href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status" rel="disclosure">public
list of any patent disclosures</a> made in connection with the
deliverables of the group; that page also includes instructions for
disclosing a patent. An individual who has actual knowledge of a patent
which the individual believes contains <a href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</a>.</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="#custom-property"><span class="secno">2.3. </span>
Custom property</a></li>
<li><a href="#property-reference"><span class="secno">2.4. </span>
Property reference</a> </li>
</ul>
</li>
<li><a href="#referencing-token-streams"><span class="secno">3. </span>
Referencing token streams</a>
<ul class="toc">
<li><a href="#dollar-glyph"><span class="secno">3.1. </span> The $
Prefix</a> </li>
<li><a href="#get-ref"><span class="secno">3.2. </span>Property
References - the ‘<code class="css">$()</code>’ notation</a> </li>
<li><a href="#parent-ref"><span class="secno">3.3. </span> Parent's
Property References - the ‘<code class="css">$parent()</code>’
notation</a> </li>
<li><a href="#using-invalid-references"><span class="secno">3.4. </span>
Using invalid token streams</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. By
their nature, they describe important implicit design relationships.
For example, most authors design a palette consisting of a small number of
colors and font treatments which are used repeatedly in numerous rules,
targeting disparate pieces of the tree. Today, the intended link between
those values is often lost, 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 a property 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. </p>
<p>Thus, what were previously arbitrary-seeming values (like #cfcfff) may
now have informative names (like my-primary-color). This makes authoring
and editing such files much easier and less error-prone, as one only has
to change the value once, at the property declaration site, and the change
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">
<img alt="[GREEN WEBSITE]" src="./site-color-scheme-green.jpg">
<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> my-dark-color: #770000;<br> my-light-color: #ffdddd;<br> my-color: #eebbbb;<br> }<br>}<br><br><strong>/* green color scheme */</strong><br>@document url-prefix("http://example.com/green-section") {<br> html {<br> my-dark-color: #007700;<br> my-light-color: #ddffdd;<br> my-color: #bbeebb;<br> }<br>}<br><br><strong>/* blue color scheme */</strong><br>@document url-prefix("http://example.com/blue-section") {<br> html { <br> my-dark-color: #000077; <br> my-light-color: #ddddff; <br> my-color: #bbbbee;<br> }<br>}<br><br><strong>/* website styling */</strong><br>header { background-color: $(my-dark-color); }<br>nav { background-color: $(my-light-color); }<br>nav .selected { background-color: $(my-color); }<br>h1 { color: $(my-dark-color); }<br>…<br></pre>
</div>
<p>Additionally, this module aims to provide a way for authors to share
custom styling information to their HTML components and in the shadow tree
of elements 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><style><br> .no-toolbar { my-toolbar-display: none }<br></style><br><br><my-property-editor <br> data-for="document.body"<br> class="no-toolbar" <br>/><br></pre>
<p>In the shadow tree style of the <code><my-property-editor></code>
element, the following CSS could be used:</p>
<pre>#toolbar { display: $(my-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 * $(my-radius));
height: calc(5px * $(my-radius));<br> <br> animation:<br> fallOnTheGround 15s infinite;<br> animation-duration:<br> calc(15s * $(my-weight));<br> my-horizontal-bouncing:<br> calc(5px / $(my-radius) / $(my-radius));<br>}<br><br>.small.snow { my-radius: 0.9; }<br>.snow { my-radius: 1.0; }<br>.big.snow { my-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 by all properties 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
<color> 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 or in the CSS Syntax specification <a href="#CSS3-SYNTAX"
rel="biblioentry">[CSS3-SYNTAX]<!--{{!CSS3-SYNTAX}}--></a> when it will
reach the W3C Recommendation status. To be valid, a token stream must
conform to the <a href="#value-type"><value></a> type (a token
stream which doesn't conform is called an <a href="#invalid-token-stream">invalid
token stream</a>). </p>
<p>The <dfn id="stream-name">name</dfn> of a token stream is defined as a
valid CSS identifier which can be used to reference the token stream from
its attachment.</p>
<div class="note">
<p>Given the <a href="#value-type"><value></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> is a set of CSS tokens used in a
property declaration to reference, by the mean of a <dfn>provider</dfn>
and an unique <dfn>name</dfn>, a <a href="#token-stream">token stream</a>
called the <dfn id="provided-value">provided value</dfn> and, optionally,
provides a second token stream called the <dfn id="fallback-value">fallback
value</dfn>.</p>
<p>If a declaration, once all token stream references are substituted in, is
invalid, then the declaration is <a href="#invalid-at-computed-value-time"><i>invalid
at computed-value time</i></a>. </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 { my-length: 20px; }
p { background-color: $(my-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>
<p>As noted before, in addition to a reference to a token stream, token
stream references can also contains a fallback value that can be used if
the referenced token stream is found to be not appropriate for the purpose
it has been used for.</p>
<p class="needWork">THE FOLLOWING FEATURE IS AT RISK</p>
<p>Whenever a token stream reference specifies a fallback value, that value
should be valid for the purpose it has been used for. If this is not the
case, the token reference invalidates the declaration that contains it. If
it is impossible to check if the provided fallback value is valid or not
(for example because another token stream reference inside the same
declaration has no fallback value provided), the declaration is considered
valid.</p>
<p>To summarize: In order to be considered valid, a declaration containing
one or more token stream references must either: a) contain at least one
reference which provides no fallback value -OR- b) must be valid when all
property references are replaced by their fallback value.</p>
<div class="example">
<p>Given the following CSS file, a conforming user agent should display
each matching DIV element with a white text over a green background.</p>
<pre>div {<br> my-background-color: green;<br> my-foreground-color: white;<br> my-secondary-color: red;<br> <br> color: $(my-foreground-color); // valid<br> color: $(my-secondary-color, 10px); // invalid<br> <br> background-color: yellow; // valid (overridden)<br> background-color: $(my-background-color, blue); // valid<br>}</pre>
</div>
<div class="note">
<p>The rationale behind this restriction is to allow proper fallback for
unsupported features.</p>
<pre>.selector {<br> background: $(my-bg-color);<br> background: $(my-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">my-bg-color</span>'
custom property value. </p>
<pre></pre>
</div>
<p class="needWork">THE PREVIOUS FEATURE IS AT RISK<br>
</p>
<p>A token stream reference can be used in place of any component value, in
any property declaration. </p>
<p class="note">This specification doesn't define a way to use token stream
references anywhere else. An UA conforming to this specification should
not accept token stream references in property names, in selectors, or
anywhere else besides property values - doing so either produces either an
invalid value or a valid value that nonetheless has no relation to the
property of that name. </p>
<p>The exact syntax of some token stream references is defined in the <a href="#referencing-token-streams">Chapter
3</a> of this specification.</p>
<h3 id="custom-property"><span class="secno">2.3. </span> Custom property</h3>
<p> This specification defines an open-ended set of properties called <a href="#custom-property"><i>custom
properties</i></a>, which can be used as <a href="#token-stream-reference"><i>token
streams</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>
<p class="note">Future revisions of this specification may or may not allow
any CSS property to be used as a token stream. </p>
<table class="propdef">
<tbody>
<tr>
<th>Name: </th>
<td><dfn id="my-properties">my-*</dfn> </td>
</tr>
<tr>
<th>Values: </th>
<td><a href="#value-type"><var><value></var></a> </td>
</tr>
<tr>
<th>Initial: </th>
<td>(nothing, 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>specified value with token stream references substituted (but see
prose for "invalid token streams") </td>
</tr>
<tr>
<th>Media: </th>
<td>all </td>
</tr>
</tbody>
</table>
<p>The <dfn id="value-type"><var><value></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>.
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()). However, 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 "my-"
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 initial value of a <a href="#custom-property"><i>custom property</i></a>
is an empty invalid value. This means that, until a <a href="#custom-property"><i>custom
property</i></a> is explicitly defined otherwise by a style sheet, 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
pass custom data around their page, similar to 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> 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>
<p>A <a href="#custom-property"><i>custom property</i></a> declaration
defines a <a href="#token-stream">token stream</a> whose attachment is
the element the declaration applies to and whose scope is the element
itself and all its descendants. This means that for each <a href="#custom-property"><i>custom
property</i></a>, there is an associated token stream with the same
name. See the next chapter for details on how to reference those token
streams. </p>
<div class="example">
<p> This style rule: </p>
<pre>:root {
my-header-color: #06c;
}</pre>
<p>declares a <a href="#custom-property"><i>custom property</i></a> named
"my-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: $(my-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">$(my-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">my-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, are resolved with the normal inheritance and cascade rules, can
be made conditional with ‘<code class="css">@media</code>’ and other
conditional rules, can be used in HTML's <code>style</code> attribute,
can be read or set using the CSSOM, etc.. </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 { my-color: blue; }
div { my-color: green; }
#alert { my-color: red; }
* { color: $(my-color); }
<p>I inherited blue from the root element!</p>
<div>I got green set directly on me!</div>
<div id='alert'>
While I got red set directly on me!
<p>I'm red too, because of inheritance!</p>
</div></pre>
</div>
<p><a href="#custom-property"><i>Custom properties</i></a> may use property
references in their own values to build up composite properties. As this
can create cyclic dependencies where two or more <a href="#custom-property"><i>custom
properties</i></a> each attempt to use a reference to each other,
doing so makes all the <a href="#custom-property"><i>custom properties</i></a>
involved in the cycle compute to their initial value (which is a
guaranteed-invalid value). </p>
<div class="example">
<p>This example shows a custom property safely using a property reference:
</p>
<pre>:root {
my-main-color: #c06;
my-accent-background: linear-gradient(to top, $(my-main-color), white);
}</pre>
<p>The ‘<code class="property">my-accent-background</code>’ property
(along with any other properties that use ‘<code class="css">$(my-main-color)</code>’)
will automatically update when the ‘<code class="property">my-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 {
my-first-property: calc($(my-second-property) + 20px);
my-second-property: calc($(my-first-property) - 20px);
}</pre>
<p>Both ‘<code class="property">my-one</code>’ and ‘<code class="property">my-two</code>’
now define <a href="#invalid-token-stream"><i>invalid token streams</i></a>
rather than lengths. </p>
</div>
<p>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> in their values at computed-value time, which
occurs <em>before</em> the value is inherited. 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>
<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><one><two><three /></two></one>
one { my-foo: 10px; }
two { my-bar: calc($(my-foo) + 10px); }
three { my-foo: calc($(my-bar) + 10px); }</pre>
<p>The <one> element defines a value for ‘<code class="property">my-foo</code>’.
The <two> element inherits this value, and additionally assigns a
value to ‘<code class="property">my-bar</code>’ by referencing
<one>'s ‘<code class="css">my-foo</code>’ property. Finally, the
<three> element inherits the ‘<code class="property">my-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">my-foo</code>’ in terms of that value.
Since the value it inherited for ‘<code class="property">my-bar</code>’
no longer contains a reference to the ‘<code class="property">my-foo</code>’
property defined on <one>, defining ‘<code class="property">my-foo</code>’
using ‘<code class="css">$(my-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>’. </p>
</div>
<h3 id="property-reference"><span class="secno">2.4. </span> Property
reference<br>
</h3>
<p>A <strong>property reference</strong> is a token stream reference that
allows the value of a <a href="#custom-property"><i>custom property</i></a>
defined on an element to be substituted into another property which has
access to it.</p>
<p>The <a href="#provided-value">provided value</a> of a CSS property is
either the specified value of the property (after the substitution of any
valid token stream reference it contained) if is is declared on the
element, or its inherited/initial value otherwise, depending of whether
that property was inherited or not. </p>
<p>If such property doesn't exist or is invalid, and a second argument was
provided, then the fallback value of the reference is used instead.
Otherwise, the reference represents an <a href="#invalid-token-stream"><i>invalid
token stream</i></a>.</p>
<p></p>
<!-- USING -->
<h2 id="referencing-token-streams"><span class="secno">3. </span>
Referencing token streams</h2>
<h3 id="dollar-glyph"><span class="secno">3.1. </span> The $ Prefix</h3>
<p>When used as or in a value production, the dollar glyph indicates that
what follows is some form of token stream reference. Formally, the syntax
of a <a href="#token-stream-reference">token stream reference</a> is: </p>
<pre><dfn id="ref-type"><ref></dfn> = "$" [<var>provider</var>]? ( <var>stream-name</var> [, <a
href="#value-type"><var><value></var></a> ]? )</pre>
<p> ...where <var>provider</var> and <var>stream-name</var> are anything
matching the IDENT production in <a href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS2.1
Chapter 4</a> and respectively corresponds to an <dfn>reference
provider</dfn> and to the name of the referenced <a href="#token-stream">token
stream</a>. </p>
<p>If the <var>provider</var> token is not present, the token stream
reference refers to the <a href="#default-attachment">default provider</a>.
If the <var>provider</var> token is present but doesn't match any defined
reference provider, the declaration is invalid.<br>
</p>
<p>The second argument of the reference 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: $foo(bar, fallback value); }</pre>
<p>The '<code class="css">$</code>' token indicates the start of a token
stream reference. <br>
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 computed-value time, token stream references are substituted for the
tokens contained in their referenced token stream or, if it is invalid,
for the tokens of their fallback value, if any. Otherwise, the declaration
is invalid.</p>
<div class="note">
<p>In future iterations of this specification, we may want to provide more
complex features for the $ prefix, like conditional token stream
references or token stream decorators. This is one of the reasons why
the $ prefix is not soldered with the custom property name in the
declaration.</p>
<pre>.conditional { content: $if(a,b,c); }<br>.braced-syntax { property: ${abc|def|ijk}; }<br></pre>
<p>Please note this is an informative box which is not indicative of any
endorsement of the syntax nor of the utility of the specified use cases.
This is just a reminder we may want to expand the syntax of token stream
references in the future.<br>
</p>
</div>
<h3 id="get-ref"><span class="secno">3.2. </span>Property References - the
‘<code class="css">$()</code>’ notation</h3>
<p>The <dfn id="default-attachment">default provider</dfn> of a token
stream reference is the element on which the property is applied.</p>
<p>The default provider allows to reference other properties applying on the
same element as the one the property it is declared in.</p>
<p class="note">Properties whose value is inherited are also targetable,
even if they are not specifically applying on the element.</p>
<div class="example">
<p> For example, the following code defines and references a custom
property named "my-main-color". </p>
<pre>:root {
my-main-color: blue;
}
h1 {
color: $(my-main-color);
}</pre>
</div>
<p>In some cases, it can be useful to provide a fallback value for a
property reference in case the referenced property isn't defined or is
invalid. </p>
<p class="note">For example, if a site uses custom properties to provide
"hooks" for customization, expecting the custom property to be defined in
a separate custom stylesheet, the main stylesheet can use default values
for its property reference so that the theming stylesheet can just
override the properties it cares about, rather than being forced to
provide values for all of them. </p>
<p>The fallback value of the ‘<code class="css">$()</code>’ notation is its
second argument.</p>
<h3 id="parent-ref"><span class="secno">3.3. </span> Parent's Property
References - the ‘<code class="css">$parent()</code>’ notation</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">$parent()</code>’
notation: </p>
<p>The ‘<code class="css">parent</code>’ <a href="#attachment-identifier">provider</a>
allows to reference properties applying on the parent of the element the
property it is declared in applies, if such parent exists. If it doesn't,
then the referenced token stream is <a href="#invalid-token-stream">invalid</a>.</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">$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><div class='comment'>
<div class='main'>
...
</div>
<div class='actions'><a>Reply</a> <a>Comment</a> ...</div>
</div>
<div class='comment'>
<div class='main'>
<div class='comment'>
<div class='main'>
...
</div>
<div class='actions'><a>Reply</a> <a>Comment</a> ...</div>
</div>
</div>
<div class='actions'><a>reply</a> <a>Comment</a> ...</div>
</div>
<style>
.comment {
my-bg: $parent(my-bg2, white);
my-bg2: $parent(my-bg, silver);
background: url(comment.png) $(my-bg);
}
</style></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><div class='main'></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">$()</code>’ notation can't be used here either
as it would immediately produce a cycle between '<code class="css">my-bg</code>'
and '<code class="css">my-bg2</code>', making them both invalid. </p>
</div>
<h3 id="using-invalid-references"><span class="secno">3.4. </span> Using
invalid token streams</h3>
<p> When a <a href="#custom-property"><i>custom property</i></a> has its
initial value, the <a href="#token-stream-reference"><i>token stream</i></a>
it defines represents an <dfn id="invalid-token-stream">invalid token
stream</dfn>. </p>
<p>Using an <a href="#invalid-token-stream"><i>invalid token stream</i></a>
in a property declaration (including other <a href="#custom-property"><i>custom
properties</i></a> declarations) makes the declaration <a href="#invalid-at-computed-value-time"><i>invalid
at computed-value time</i></a>. </p>
<p> A declaration can be <dfn id="invalid-at-computed-value-time">invalid
at computed-value time</dfn> if it uses an invalid <a href="#token-stream-reference"><i>token
stream reference</i></a>, as explained above, or if it uses a valid <a
href="#token-stream"><i>token stream reference</i></a>, but the property
value, after substituting its <a href="#token-stream-reference"><i>token
stream references</i></a>, is invalid. 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. </p>
<div class="example">
<p>For example, in the following code: </p>
<pre>:root { my-bad-color: 20px; }
p { background-color: red; }
p { background-color: $(my-bad-color); }</pre>
<p>the <p> elements will have transparent backgrounds (the initial
value for ‘<code class="property">background-color</code>’), rather than
red backgrounds. The same would happen if the reference itself was
invalid. </p>
<p>Note the difference between this and what happens if the author had
just written ‘<code class="css">background-color: 20px</code>’ directly
in their stylesheet - that would be a normal syntax error, which would
cause the rule to be discarded, so the ‘<code class="css">background-color:
red</code>’ rule would be used instead. </p>
</div>
<p class="note">The <a href="#invalid-at-computed-value-time"><i>invalid at
computed-value time</i></a> concept exists because token stream
references can't "fail early" like other syntax errors can, so by the time
the user agent realizes a property value is invalid, it is already thrown
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">$()</code>’ and '<span class="css">$parent()</span>'
functions. </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 attachment;
attribute DOMString streamName;
attribute any fallbackValue;
readonly attribute any providedValue;
}</pre>
</dd>
<dt>Attributes </dt>
<dd>
<dl>
<dt><code>attachment</code> of type <code>DOMString</code> </dt>
<dd>This attribute represents the name of the attachment of the
referenced token stream. <span>Valid values includes <a href="#get-ref">''</a>
and <a href="#parent-ref">'parent'</a>.</span></dd>
<dt> <code>streamName</code> of type <code>DOMString</code> </dt>
<dd>This attribute represents the first argument to the function.
Changing this attribute changes the <a href="#custom-property"><i>custom
property</i></a> being referred to. </dd>
<dt><code>fallbackValue</code> of type any </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>. </dd>
<dt><code>providedValue</code> of type <code>any</code>, readonly </dt>
<dd>This attribute represents the value provided by the referenced
token stream. If the <code>attachment</code> doesn't map to any
defined attachment, if no valid token stream matches <code>streamName</code>,
or if the provided value is invalid, the value of this attribute is
guaranteed to 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>
<p class="issue"> 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. The most natural way seems to be to first, set up a
getter behavior on the interface somehow that deals with custom
properties, and second, set up a <code>my</code> map that exposes the
custom properties that aren't set to their initial value. </p>
<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. </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>Percentages </th>
<th>Media </th>
</tr>
</thead>
<tbody>
<tr>
<th><a class="property" href="#var-">my-*</a> </th>
<td><value> </td>
<td>(nothing, see prose) </td>
<td>all elements </td>
<td>yes </td>
<td>specified value with token stream references substituted (but see
prose for "invalid token streams") </td>
<td>all </td>
</tr>
</tbody>
</table>
<!--end-properties-->
</body>
</html>