-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraft.html
More file actions
1170 lines (1143 loc) · 65.4 KB
/
draft.html
File metadata and controls
1170 lines (1143 loc) · 65.4 KB
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
991
992
993
994
995
996
997
998
999
1000
<!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. 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
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. </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">
<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> x-dark-color: #770000;<br> x-light-color: #ffdddd;<br> x-color: #eebbbb;<br> }<br>}<br><br><strong>/* green color scheme */</strong><br>@document url-prefix("http://example.com/green-section") {<br> html {<br> x-dark-color: #007700;<br> x-light-color: #ddffdd;<br> x-color: #bbeebb;<br> }<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><style><br> .no-toolbar { x-toolbar-display: none }<br></style><br><br><x-property-editor <br> data-for="document.body"<br> class="no-toolbar" <br>/><br></pre>
<p>In the shadow tree style of the <code><x-property-editor></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> 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
<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 (<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"><value></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"><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> (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. </p>
<p>The <dfn id="reference-type-type"><var><reference-type></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><reference-type></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><value></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><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>.
<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); }
<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>
<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><one><two><three /></two></one>
one { x-foo: 10px; }
two { x-bar: calc(get(x-foo) + 10px); }
three { x-foo: calc(get(x-bar) + 10px); }</pre>
<p>The <one> element defines a value for ‘<code class="property">x-foo</code>’.
<br></p>
<p>The <two> element inherits this value, and additionally assigns a
value to ‘<code class="property">x-bar</code>’ by referencing
<one>'s ‘<code class="css">x-foo</code>’ property. <br>
</p>
<p>Finally, the <three> 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 <one>, 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"><ref></dfn> = "get" ( <var><reference-path></var> [ "|" <<var>reference-type</var>> [ "|" <a
href="#value-type"><var><value></var></a> ]? ]? )</pre>
<p> ...where <var><reference-path></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 (<color> 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>. </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>'. </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><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><br>
.comment {
x-bg1: get(parent x-bg2, white);
x-bg2: get(parent x-bg1, silver);
background: get(x-bg1);
}<br>
</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">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 <p> elements will have transparent backgrounds (the initial
value for ‘<code class="property">background-color</code>’), rather than
red backgrounds. </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
<reference-path>, 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 <reference-type>, 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 <value> 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