Skip to content

Commit 054f195

Browse files
committed
[css-values] Issue #250 - Allow <percentage> to be its own type, for some hypothetical future use.
1 parent fc3b852 commit 054f195

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

css-values-3/Overview.bs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,12 +1438,12 @@ Mathematical Expressions: ''calc()''</h3>
14381438
<<frequency>>,
14391439
<<angle>>,
14401440
<<time>>,
1441+
<<percentage>>,
14411442
<<number>>, or
14421443
<<integer>>
14431444
values are allowed.
1444-
Components of a ''calc()'' expression can be literal values,
1445-
''attr()'' or ''calc()'' expressions,
1446-
or <<percentage>> values that resolve to one of the preceding types.
1445+
Components of a ''calc()'' expression can be literal values or
1446+
''attr()'' or ''calc()'' expressions.
14471447

14481448
<div class="example">
14491449
<pre>
@@ -1534,6 +1534,7 @@ Type Checking</h4>
15341534
<<frequency>>,
15351535
<<angle>>,
15361536
<<time>>,
1537+
<<percentage>>,
15371538
<<number>>, or
15381539
<<integer>>.
15391540
The <a>resolved type</a> must be valid for where the expression is placed;
@@ -1545,8 +1546,13 @@ Type Checking</h4>
15451546
An ''attr()'' expression's type is given by its <<type-or-unit>> argument.
15461547

15471548
If percentages are accepted in the context in which the expression is placed,
1548-
a <<percentage-token>> has the type of the value that percentages are relative to;
1549-
otherwise, a math expression containing percentages is invalid.
1549+
a <<percentage-token>> has the type of the value that percentages are relative to.
1550+
For example, in the 'width' property, percentages have the <<length>> type,
1551+
and in 'opacity' they have the <<number>> type.
1552+
A percentage only has the <<percentage>> type if in that context
1553+
<<percentage>> values are not used-value compatible with any other type.
1554+
If percentages are not normally allowed in place of the ''calc()'',
1555+
then a ''calc()'' expression containing percentages is invalid in that context.
15501556

15511557
Operators form sub-expressions, which gain types based on their arguments.
15521558
To make expressions simpler,
@@ -2044,6 +2050,9 @@ Changes</h2>
20442050
<li>Added definition of <<ident>> notation to definition of <a>identifiers</a>.
20452051
<li>Added <<length-percentage>> as a shorthand for <<length>> | <<percentage>>,
20462052
along with equivalent productions for angles, numbers, times, and frequencies.
2053+
<li>Allowed <<percentage>>s inside ''calc()'' to resolve as their own type,
2054+
if they occur in some (as yet theoretical) context
2055+
where they are not compatible with any other type.
20472056
<li>Various clarifications and editorial improvements.
20482057
</ul>
20492058

css-values-3/issues-cr-2015.bsi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,7 @@ Comment: https://github.com/w3c/csswg-drafts/issues/271#issuecomment-230905898
212212
Closed: Accepted
213213
Resolved: Editorial
214214
----
215+
Issue 27.
216+
Summary: Clarify that <percentage> can be a resolved type
217+
From: Tab Atkins
218+
Comment: https://github.com/w3c/csswg-drafts/issues/250

0 commit comments

Comments
 (0)