Skip to content

Use bracket range notation in syntax grammar [css-values-3][css-values-4][css-backgrounds-3][css-backgrounds-4][css-multicol-1][css-multicol-2][css-flexbox-1][css-counter-styles-3] #3894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[css-values-4] Copy over bracket range definition
These changes were added to Level 3 in
8ea8d7d
and
1265976

(And fix a tabs-vs-spaces error that bikeshed was choking on.)
  • Loading branch information
AmeliaBR committed May 5, 2019
commit ded9374ec4ed0c89a333e674d4fe27963580a26a
47 changes: 39 additions & 8 deletions css-values-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Component value types</h3>
<li>
basic data types, which appear between <css>&lt;</css> and <css>></css>
(e.g., <<length>>, <<percentage>>, etc.).
For <a>numeric data types</a>,
this type notation can annotate any range restrictions
using the [[#numeric-ranges|bracketed range notation]] described below.

<li>
types that have the same range of values as a property bearing the same name
Expand Down Expand Up @@ -782,14 +785,42 @@ Numeric Data Types</h2>
they represent the value’s abstract quantity,
not its syntactic representation.

Properties may restrict numeric values to some range.
If the value is outside the allowed range,
unless otherwise specified,
the declaration is invalid and must be <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.

CSS theoretically supports infinite precision and infinite ranges for all value types;
however in reality implementations have finite capacity.
UAs should support reasonably useful ranges and precisions.
<h3 id="numeric-ranges">
Range Restrictions and Range Definition Notation</h3>

Properties can restrict numeric values to some range.
If the value is outside the allowed range,
then unless otherwise specified,
the declaration is invalid and must be <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignored</a>.
Range restrictions can be annotated in the numeric type notation
using <dfn>bracketed range notation</dfn>,
<code>[<var>min</var>,<var>max</var>]</code>
within the angle brackets, after the identifying keyword,
indicating a closed range
between (and including) <var>min</var> and <var>max</var>.
For example, <<integer [0,10]>> indicates an integer between 0 and 10, inclusive.

Note: CSS values generally do not allow open ranges;
thus only square-bracket notation is used.

CSS theoretically supports infinite precision and infinite ranges for all value types;
however in reality implementations have finite capacity.
UAs should support reasonably useful ranges and precisions.
Range extremes that are ideally unlimited
are indicated using &infin; or &minus;&infin; as appropriate.
For example, <<length [0, &infin;]>> indicates a non-negative length.

If no range is indicated,
either by using the <a>bracketed range notation</a>
or in the property description,
then <code>[&minus;&infin;,&infin;]</code> is assumed.

Note: At the time of writing,
the <a>bracketed range notation</a> is new;
thus in most CSS specifications
any range limitations are described only in prose.
This does not make them any less binding.
<!--
The recommended minimum ranges and precision,
and the required rounding and clamping rules,
Expand Down Expand Up @@ -3248,7 +3279,7 @@ Serialization</h3>
2. The percentage, if present
3. The dimensions, ordered by their units <a>ASCII case-insensitive</a> alphabetically
4. <a href="#comp-func">Comparison</a>, <a href="#trig-funcs">trigonometric</a>
and <a href="#exponent-funcs">exponential</a> functions,
and <a href="#exponent-funcs">exponential</a> functions,
in the order they appeared in the original expression.

2. Serialize all the terms,
Expand Down