Skip to content

Commit 892db15

Browse files
committed
added cycle(), added text about URLs inside functions
1 parent 2eac224 commit 892db15

1 file changed

Lines changed: 122 additions & 0 deletions

File tree

css3-values/Overview.src.html

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,77 @@ <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
5151
</div>
5252

5353

54+
<!--
55+
56+
[css3-values] cycle() values?
57+
58+
From: L. David Baron <dbaron@dbaron.org>
59+
Date: Thu, 30 Mar 2006 01:20:00 -0800
60+
61+
I'd like to resurrect an old proposal for addition to css3-values [1]:
62+
http://lists.w3.org/Archives/Public/www-style/1999May/0067
63+
http://lists.w3.org/Archives/Public/www-style/1999Jun/0026
64+
This is particularly useful for styling HTML's UL and EM elements.
65+
66+
Proposed text that could be used in the specification is the following:
67+
68+
=====
69+
70+
The cycle() expression allows descendant elements to cycle over a list
71+
of values instead of inheriting the same value. The syntax of the
72+
cycle() expression is:
73+
74+
cycle( <value> [, <value> ]*)
75+
76+
where <value> is a CSS value that is valid where the expression is
77+
placed. If any of the values inside are not valid, then the entire
78+
cycle() expression is invalid.
79+
80+
The value returned by cycle() must be determined by comparing the
81+
inherited value I (the computed value on the parent, or, for the root,
82+
the initial value) to the computed values C[n] returned by the n-th
83+
argument to cycle(). For the earliest C[n] such that C[n] == I, the
84+
value returned by cycle is C[n+1]. However, if this C[n] is the last
85+
value, or if there are no C[n] that equal I, the computed value of the
86+
first value is returned instead.
87+
88+
Example 1:
89+
90+
/* make em elements italic, but make them normal if they're inside
91+
something that's italic */
92+
em { font-style: cycle(italic, normal); }
93+
94+
Example 2:
95+
96+
/* cycle between markers for nested lists, so that the top level has
97+
disk markers, but nested lists use circle, square, box, and then
98+
(for the 5th list deep) repeat */
99+
ul { list-style-type: disk; }
100+
li > ul { list-style-type: cycle(disk, circle, square, box); }
101+
102+
=====
103+
104+
It could also be used in other interesting ways -- probably some bizarre
105+
ones that I haven't even thought of yet. Although I admit I have
106+
already thought of:
107+
list-style-type: cycle(cycle(disc,disc,circle,circle), cycle(disc,circle),
108+
cycle(square,square,box,box), cycle(square,box));
109+
Understanding this is left as an exercise to the reader.
110+
111+
112+
=======================================================
113+
http://lists.w3.org/Archives/Public/www-style/2009Mar/0065.html
114+
115+
116+
117+
- RESOLVED: URLs inside functional notation where URL is expected should be able
118+
to take either url() or bare strings (like @import), preference for
119+
examples is bare strings.
120+
121+
122+
-->
123+
124+
54125
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
55126

56127
<p>This CSS3 module describes the various values and units that CSS
@@ -227,8 +298,10 @@ <h3>Functional notation</h3>
227298
(',') with optional whitespace before and after the comma.
228299

229300
<div class="example">
301+
<pre>
230302
background: url(http://www.example.org/image);
231303
color: rgb(100, 200, 50 );
304+
</pre>
232305
</div>
233306

234307
<p>Some properties accept space- or comma-separated lists of values. A value
@@ -237,6 +310,47 @@ <h3>Functional notation</h3>
237310
value is a <dfn>simple value</dfn>.
238311

239312

313+
<h3>Cycle function</h3>
314+
315+
<p>The cycle() expression allows descendant elements to cycle over a list
316+
of values instead of inheriting the same value. The syntax of the
317+
cycle() expression is:
318+
319+
<pre>
320+
cycle( &lt;value> [, &lt;value> ]*)
321+
</pre>
322+
323+
where &lt;value> is a CSS value that is valid where the expression is
324+
placed. If any of the values inside are not valid, then the entire
325+
cycle() expression is invalid.
326+
327+
<p>The value returned by cycle() must be determined by comparing the
328+
inherited value I (the computed value on the parent, or, for the root,
329+
the initial value) to the computed values C[n] returned by the n-th
330+
argument to cycle(). For the earliest C[n] such that C[n] == I, the
331+
value returned by cycle is C[n+1]. However, if this C[n] is the last
332+
value, or if there are no C[n] that equal I, the computed value of the
333+
first value is returned instead.
334+
335+
<div class="example">
336+
<p>Make em elements italic, but make them normal if they're inside something that's italic:
337+
<pre>
338+
em { font-style: cycle(italic, normal); }
339+
</pre>
340+
</div>
341+
342+
<div class="example">
343+
<p>Cycle between markers for nested lists, so that the top level has disk markers, but nested lists use circle, square, box, and then (for the 5th list deep) repeat:
344+
345+
<pre>
346+
ul { list-style-type: disk; }
347+
li > ul { list-style-type: cycle(disk, circle, square, box); }
348+
</pre>
349+
</div>
350+
351+
<p>Nested cycle() values are not allowed.
352+
353+
240354
<h2>Keywords</h2>
241355

242356
<p>In the value definition fields, keywords appear literally. Keywords are identifiers.</p>
@@ -953,6 +1067,14 @@ <h3 id="uris">&lt;url&gt;</h3>
9531067
<p>User agents may vary in how they handle URIs that designate unavailable or
9541068
inapplicable resources.</p>
9551069

1070+
1071+
<p>URLs inside functional notation where URL is expected should be
1072+
able to take either url() or bare strings.
1073+
1074+
1075+
1076+
<!-- (like @import), preference for examples is bare strings. -->
1077+
9561078
<h3>&lt;image&gt;</h3>
9571079

9581080
<p>TBD.

0 commit comments

Comments
 (0)