Skip to content

Commit 46b0c7d

Browse files
committed
[css-values-5] Define <whole-value>, make toggle() and mix() use it. #9341
1 parent 8f17fed commit 46b0c7d

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

css-values-5/Overview.bs

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ Interpolated Property Values: the ''mix()'' notation</h3>
411411

412412
<pre class="prod">
413413
<dfn><<mix()>></dfn> =
414-
mix( <<progress>> ';' <<declaration-value>>? ';' <<declaration-value>>? ) |
414+
mix( <<progress>> ';' <<whole-value>> ';' <<whole-value>> ) |
415415
mix( <<progress>> && of <<'animation-name'>> )
416416
</pre>
417417

@@ -475,12 +475,10 @@ Interpolated Property Values: the ''mix()'' notation</h3>
475475
</pre>
476476
</div>
477477

478-
A ''mix()'' notation is invalid
479-
if it is not the sole value of the property;
480-
if either of its <<declaration-value>>s
481-
are invalid when specified as the entire value
482-
for the property the function is used in;
483-
or if the property using it is [=not animatable=].
478+
The ''mix()'' notation is a <<whole-value>>.
479+
Additionally,
480+
if any of its <<whole-value>> arguments are [=not animatable=],
481+
the notation is invalid.
484482

485483
<div class="example">
486484
For example, the following declarations are invalid,
@@ -501,6 +499,28 @@ Interpolated Property Values: the ''mix()'' notation</h3>
501499
<h2 id="value-insert">
502500
Miscellaneous Value Substituting Functions</h2>
503501

502+
<h3 id="whole-value" type lt="<whole-value>">
503+
Representing An Entire Property Value: the <<whole-value>> type</h3>
504+
505+
Several functions defined in this specification
506+
can only be used as the "whole value" of a property.
507+
For example, ''background-position: toggle(50px 50px, center);'' is valid,
508+
but ''background-position: toggle(50px, center) 50px;'' is not.
509+
The <<whole-value>> production represents these values.
510+
511+
All properties implicitly accept a <<whole-value>>
512+
as their entire value,
513+
just as they accept the [=CSS-wide keywords=]
514+
as their entire value.
515+
516+
When used as a component value of a function,
517+
<<whole-value>> also represents any CSS value
518+
normally valid as the whole value
519+
of the property in which it is used
520+
(including additional <<whole-value>> functions).
521+
However, some functions may restrict
522+
what a <<whole-value>> argument can include.
523+
504524
<!--
505525
████████ ███████ ██████ ██████ ██ ████████ ███ ███
506526
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
@@ -536,22 +556,16 @@ Toggling Between Values: ''toggle()''</h3>
536556

537557
The syntax of the ''toggle()'' expression is:
538558

539-
<pre>toggle( <<toggle-value>> [ ';' <<toggle-value>> ]+ )</pre>
540-
541-
where <dfn>&lt;toggle-value></dfn> is any CSS value
542-
that is valid where the expression is placed.
543-
If any of the values inside are not valid,
544-
then the entire ''toggle()'' expression is invalid.
545-
The ''toggle()'' expression may be used as the value of any property,
546-
but must be the only component in that property's value.
559+
<pre>toggle( <<whole-value>> [ ';' <<whole-value>> ]+ )</pre>
547560

548561
Note: This [=functional notation=] uses semicolons to separate arguments
549562
rather than the more typical comma
550563
because the values themselves can contain commas.
551564

552-
The ''toggle()'' notation is not allowed to be nested;
553-
nor may it contain ''attr()'' or ''calc()'' notations.
554-
Declarations containing such constructs are invalid.
565+
The ''toggle()'' notation is a <<whole-value>>.
566+
However, it is not allowed to be nested,
567+
nor may it contain ''attr()'' or ''calc()'' notations;
568+
declarations containing such constructs are invalid.
555569

556570
<div class="example">
557571
The following ''toggle()'' examples are all invalid:

0 commit comments

Comments
 (0)