Skip to content

Commit 8a55a54

Browse files
committed
Some clarifications to toggle().
1 parent f02f9e3 commit 8a55a54

2 files changed

Lines changed: 45 additions & 40 deletions

File tree

css3-values/Overview.html

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,13 +1529,15 @@ <h3 id=toggle-notation><span class=secno>8.2. </span> Toggling Between
15291529

15301530
<pre>toggle( &lt;value&gt;# )</pre>
15311531

1532-
<p> where <var>&lt;value></var> is a CSS value that is valid where the
1532+
<p> where <var>&lt;value></var> is any CSS value that is valid where the
15331533
expression is placed. If any of the values inside are not valid, then the
15341534
entire ‘<a href="#toggle"><code class=css>toggle()</code></a>
1535-
expression is invalid.
1535+
expression is invalid. The ‘<a href="#toggle"><code
1536+
class=css>toggle()</code></a>’ expression may be used as the value of
1537+
any property (but must be the only component in that property's value).
15361538

1537-
<p class=note> Note that values with commas at the top-level will be
1538-
incorrectly interpreted as separate values.
1539+
<p class=note> Note that because toggled values are separated by commas,
1540+
they cannot themselves include top-level commas.
15391541

15401542
<p> The value returned by ‘<a href="#toggle"><code
15411543
class=css>toggle()</code></a>’ must be determined by comparing the
@@ -1549,23 +1551,6 @@ <h3 id=toggle-notation><span class=secno>8.2. </span> Toggling Between
15491551
are no <var>C<sub>n</sub></var> that equal <var>I</var>, the computed
15501552
value of the first value is returned instead.
15511553

1552-
<p class=note> Note that "computed values" are abstract sets of values, not
1553-
particular serializations, so comparison between computed values should
1554-
always be unambiguous and have the expected result. For example, ‘<code
1555-
class=property>box-shadow</code>’ computed values are just two offsets,
1556-
a blur, a spread, and a color, so the declarations ‘<code
1557-
class=css>box-shadow: 1px 1px blue;</code>’ and ‘<code
1558-
class=css>box-shadow: 1px 1px 0px blue;</code>’ produce identical
1559-
computed values. If the "Computed Value" line of a property definition
1560-
seems to define something ambiguous or overly strict, please <a
1561-
href="#status">provide feedback</a> so we can fix it.
1562-
1563-
<p class=note>Note that ‘<a href="#toggle"><code
1564-
class=css>toggle()</code></a>’ explicitly looks at the computed value of
1565-
the parent, so it is useful even for non-inherited properties. This is
1566-
similar to the ‘<a href="#inherit"><code class=css>inherit</code></a>
1567-
keyword, which is useful even for non-inherited properties.
1568-
15691554
<div class=example>
15701555
<pre>
15711556
/* make em elements italic, but make them normal if they're inside
@@ -1588,6 +1573,23 @@ <h3 id=toggle-notation><span class=secno>8.2. </span> Toggling Between
15881573
class=css>calc()</code></a>’ notations. Declarations containing such
15891574
constructs are invalid.
15901575

1576+
<p class=note> Note that "computed values" are abstract sets of values, not
1577+
particular serializations, so comparison between computed values should
1578+
always be unambiguous and have the expected result. For example, ‘<code
1579+
class=property>box-shadow</code>’ computed values are just two offsets,
1580+
a blur, a spread, and a color, so the declarations ‘<code
1581+
class=css>box-shadow: 1px 1px blue;</code>’ and ‘<code
1582+
class=css>box-shadow: 1px 1px 0px blue;</code>’ produce identical
1583+
computed values. If the "Computed Value" line of a property definition
1584+
seems to define something ambiguous or overly strict, please <a
1585+
href="#status">provide feedback</a> so we can fix it.
1586+
1587+
<p class=note> Note that ‘<a href="#toggle"><code
1588+
class=css>toggle()</code></a>’ explicitly looks at the computed value of
1589+
the parent, so it works even on non-inherited properties. This is similar
1590+
to the ‘<a href="#inherit"><code class=css>inherit</code></a>
1591+
keyword, which is works even on non-inherited properties.
1592+
15911593
<h3 id=attr-notation><span class=secno>8.3. </span> Attribute References:
15921594
<a href="#attr"><code class=css>attr()</code></a></h3>
15931595
<!--

css3-values/Overview.src.html

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,14 +1087,16 @@ <h3 id="toggle-notation">
10871087
<pre>toggle( &lt;value&gt;# )</pre>
10881088

10891089
<p>
1090-
where <var>&lt;value></var> is a CSS value
1090+
where <var>&lt;value></var> is any CSS value
10911091
that is valid where the expression is placed.
10921092
If any of the values inside are not valid,
10931093
then the entire ''toggle()'' expression is invalid.
1094+
The ''toggle()'' expression may be used as the value of any property
1095+
(but must be the only component in that property's value).
10941096

10951097
<p class='note'>
1096-
Note that values with commas at the top-level
1097-
will be incorrectly interpreted as separate values.
1098+
Note that because toggled values are separated by commas,
1099+
they cannot themselves include top-level commas.
10981100

10991101
<p>
11001102
The value returned by ''toggle()'' must be determined
@@ -1109,22 +1111,6 @@ <h3 id="toggle-notation">
11091111
or if there are no <var>C<sub>n</sub></var> that equal <var>I</var>,
11101112
the computed value of the first value is returned instead.
11111113

1112-
<p class='note'>
1113-
Note that "computed values" are abstract sets of values,
1114-
not particular serializations,
1115-
so comparison between computed values should always be unambiguous and have the expected result.
1116-
For example,
1117-
'box-shadow' computed values are just two offsets, a blur, a spread, and a color,
1118-
so the declarations ''box-shadow: 1px 1px blue;'' and ''box-shadow: 1px 1px 0px blue;''
1119-
produce identical computed values.
1120-
If the "Computed Value" line of a property definition seems to define something ambiguous or overly strict,
1121-
please <a href="#status">provide feedback</a> so we can fix it.
1122-
1123-
<p class='note'>Note that ''toggle()'' explicitly looks at the computed value
1124-
of the parent, so it is useful even for non-inherited properties. This
1125-
is similar to the ''inherit'' keyword, which is useful even for non-inherited
1126-
properties.</p>
1127-
11281114
<div class='example'>
11291115
<pre>
11301116
/* make em elements italic, but make them normal if they're inside
@@ -1145,6 +1131,23 @@ <h3 id="toggle-notation">
11451131
contain ''attr()'' or ''calc()'' notations.
11461132
Declarations containing such constructs are invalid.</p>
11471133

1134+
<p class='note'>
1135+
Note that "computed values" are abstract sets of values,
1136+
not particular serializations,
1137+
so comparison between computed values should always be unambiguous and have the expected result.
1138+
For example,
1139+
'box-shadow' computed values are just two offsets, a blur, a spread, and a color,
1140+
so the declarations ''box-shadow: 1px 1px blue;'' and ''box-shadow: 1px 1px 0px blue;''
1141+
produce identical computed values.
1142+
If the "Computed Value" line of a property definition seems to define something ambiguous or overly strict,
1143+
please <a href="#status">provide feedback</a> so we can fix it.
1144+
1145+
<p class='note'>
1146+
Note that ''toggle()'' explicitly looks at the computed value of the parent,
1147+
so it works even on non-inherited properties.
1148+
This is similar to the ''inherit'' keyword,
1149+
which is works even on non-inherited properties.
1150+
11481151
<h3 id="attr-notation">
11491152
Attribute References: ''attr()''</h3>
11501153

0 commit comments

Comments
 (0)