Skip to content

Commit 69197fd

Browse files
AmeliaBRtabatkins
andauthored
Use bracket range notation in syntax grammar [css-values-3][css… (w3c#3894)
* [css-values-3] Tidy bracket range definition - Fix incorrect heading level & a typo from 8ea8d7d - Add examples converting the notation to prose. * [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.) * [css-backgrounds-3][css-backgrounds-4] Use bracketed range notation Added bracketed range notation for non-negative values ( [0,∞] ) in these properties & productions: - <bg-size> - <line-width> - border-radius and longhands - border-image-slice - border-image-width - border-image-outset - <shadow> NOTE: required re-writing the syntax (since ony one of the 4 possible lengths has a restriction) - border-limit and border-clip in level 4 NOTE: these didn't have prose restrictions, but they also didn't explain how negative values could work. I added a changes note to level 3 (change since CR), but not level 4 (not published yet). * [css-values-3][css-values-4] Export dfn for bracketed range notation * [css-multicol-1][css-multicol-2] Use bracketed range notation Added bracketed range notation for non-negative values ( [0,∞] ) or strictly positive integers ( [1,∞] ) in these properties: - column-width - column-count - column-gap - column-span (level 2) For column-rule-width, the syntax change was made for the `<line-width>` production, in 933d7dd * [css-flexbox-1] Use bracketed range notation Added bracketed range notation for non-negative values ( [0,∞] ) in these properties: - flex-grow - flex-shrink Also use it in the prose descriptions for `flex`, and to replace the made up `<postive-number>` variable in the examples of common patterns. Created a new "Changes since the 19 November 2018 CR" section to include a mention of the update. The syntax for `flex-basis` will be updated by reference when `width` is updated. * [css-counter-styles-3] Use bracketed range notation Added bracketed range notation for non-negative values ( [0,∞] ) in the following descriptors: - pad - additive-symbols Note: I didn't add any restriction to the integer in the `system: fixed <integer>` descriptor, since there was no prose constraint. But I'm not sure that negative values make sense here. * Standardize prose for constrained values [css-backgrounds-3][css-counter-styles-3][css-flexbox-1][css-multicol-1][css-values-3][css-values-4] For all the specs covered by PR w3c#3894. <<type [0,&infin;]>> → “Negative values are not allowed.” <<integer [1, &infin;]>> → “Values must be greater than 0.” And remove some duplicate phrases. Added these phrases & the other most commonly used one (“are invalid”) to the note in CSS Values about prose restrictions. * [css-values-3][css-values-4] Fix broken entity Co-authored-by: Tab Atkins Jr <jackalmage@gmail.com>
1 parent 4bbfec1 commit 69197fd

File tree

7 files changed

+97
-49
lines changed

7 files changed

+97
-49
lines changed

css-backgrounds-3/Overview.bs

+23-20
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ layer.
924924

925925
<p>Specifies the size of the background images. Where
926926

927-
<pre class=prod><dfn><<bg-size>></dfn> = [ <<length-percentage>> | auto ]{1,2} | cover | contain</pre>
927+
<pre class=prod><dfn><<bg-size>></dfn> = [ <<length-percentage [0,&infin;]>> | auto ]{1,2} | cover | contain</pre>
928928

929929
<p>Values have the following meanings:
930930

@@ -940,7 +940,7 @@ layer.
940940
(if any), to the smallest size such that both its width and its
941941
height can completely cover the background positioning area.</dd>
942942

943-
<dt>[ <dfn><<length-percentage>></dfn>
943+
<dt>[ <dfn><<length-percentage [0,&infin;]>></dfn>
944944
| <dfn>auto</dfn> ]{1,2}</dt>
945945
<dd>
946946
<p>The first value gives the width of the corresponding image,
@@ -1633,15 +1633,15 @@ the padding is less than the radius of the corner.
16331633
<p>These properties set the thickness of the border.
16341634
Where
16351635

1636-
<pre class=prod><dfn><<line-width>></dfn> = <<length>> | thin | medium | thick</pre>
1636+
<pre class=prod><dfn><<line-width>></dfn> = <<length [0,&infin;]>> | thin | medium | thick</pre>
16371637

16381638
<p dfn-type=value dfn-for="<line-width>, border-width, border-top-width, border-left-width, border-bottom-width, border-right-width, border">
16391639
The lengths corresponding to <dfn>thin</dfn>, <dfn>medium</dfn>, and <dfn>thick</dfn>
16401640
are not specified, but the values are constant throughout a
16411641
<span>document</span> and thin &le; medium &le; thick. A UA could,
16421642
e.g., make the thickness depend on the ''medium'' font size: one
16431643
choice might be 1, 3 &amp; 5px when the ''medium'' font size is 17px or
1644-
less. Negative <<length>> values are not allowed.
1644+
less. Negative values are not allowed.
16451645

16461646
<p>'Border-width' is a shorthand that sets the
16471647
four 'border-*-width' properties. If it has four values, they set top, right,
@@ -1793,7 +1793,7 @@ the 'color' property. The fact that the
17931793
<dfn>border-bottom-left-radius</dfn>
17941794
<tr>
17951795
<th><a href="#values">Value</a>:
1796-
<td><<length-percentage>>{1,2}
1796+
<td><<length-percentage [0,&infin;]>>{1,2}
17971797
<tr>
17981798
<th>Initial:
17991799
<td>0
@@ -1821,7 +1821,7 @@ the 'color' property. The fact that the
18211821
<td><dfn>border-radius</dfn>
18221822
<tr>
18231823
<th><a href="#values">Value</a>:
1824-
<td><<length-percentage>>{1,4} [ / <<length-percentage>>{1,4} ]?
1824+
<td><<length-percentage [0,&infin;]>>{1,4} [ / <<length-percentage [0,&infin;]>>{1,4} ]?
18251825
<tr>
18261826
<th>Initial:
18271827
<td>see individual properties
@@ -2233,7 +2233,7 @@ and the border image is drawn as described in the sections below.
22332233
<td><dfn>border-image-slice</dfn>
22342234
<tr>
22352235
<th><a href="#values">Value</a>:
2236-
<td>[<<number>> | <<percentage>>]{1,4} &amp;&amp; fill?
2236+
<td>[<<number [0,&infin;]>> | <<percentage [0,&infin;]>>]{1,4} &amp;&amp; fill?
22372237
<tr>
22382238
<th>Initial:
22392239
<td>100%
@@ -2268,12 +2268,12 @@ the same as the right; if the bottom is missing, it is the same as the top;
22682268
if the right is missing, it is the same as the top.
22692269

22702270
<dl dfn-for=border-image-slice dfn-type=value>
2271-
<dt><dfn><<percentage>></dfn>
2271+
<dt><dfn><<percentage [0,&infin;]>></dfn>
22722272
<dd>Percentages are relative to the size of the image: the width
22732273
of the image for the horizontal offsets, the height for vertical
22742274
offsets.
22752275

2276-
<dt><dfn><<number>></dfn>
2276+
<dt><dfn><<number [0,&infin;]>></dfn>
22772277
<dd>Numbers represent pixels in the image (if the image is a raster
22782278
image) or vector coordinates (if the image is a vector image).
22792279

@@ -2283,7 +2283,7 @@ if the right is missing, it is the same as the top.
22832283
i.e., treated as empty.)
22842284
</dl>
22852285

2286-
<p>Negative values are invalid.
2286+
<p>Negative values are not allowed.
22872287
Computed values larger than the size of the image are interpreted as ''100%''.
22882288

22892289
<p>The regions given by the 'border-image-slice' values may overlap.
@@ -2314,7 +2314,7 @@ with no <i>specified size</i> and the <i>border image area</i> as the <i>default
23142314
<td><dfn>border-image-width</dfn>
23152315
<tr>
23162316
<th><a href="#values">Value</a>:
2317-
<td>[ <<length-percentage>> | <<number>> | auto ]{1,4}
2317+
<td>[ <<length-percentage [0,&infin;]>> | <<number [0,&infin;]>> | auto ]{1,4}
23182318
<tr>
23192319
<th>Initial:
23202320
<td>1
@@ -2348,11 +2348,11 @@ if the bottom is missing, it is the same as the top; if the right is missing,
23482348
it is the same as the top. Values have the following meanings:</p>
23492349

23502350
<dl dfn-for=border-image-width dfn-type=value>
2351-
<dt><dfn><<length-percentage>></dfn>
2351+
<dt><dfn><<length-percentage [0,&infin;]>></dfn>
23522352
<dd>Percentages refer to the size of the border image area: the width of the
23532353
area for horizontal offsets, the height for vertical offsets.
23542354

2355-
<dt><dfn><<number>></dfn>
2355+
<dt><dfn><<number [0,&infin;]>></dfn>
23562356
<dd>Numbers represent multiples of the corresponding computed
23572357
<a href="#the-border-width">border-width</a>.
23582358

@@ -2387,7 +2387,7 @@ them by <var>f</var>.
23872387
<td><dfn>border-image-outset</dfn>
23882388
<tr>
23892389
<th><a href="#values">Value</a>:
2390-
<td>[ <<length>> | <<number>> ]{1,4}
2390+
<td>[ <<length [0,&infin;]>> | <<number [0,&infin;]>> ]{1,4}
23912391
<tr>
23922392
<th>Initial:
23932393
<td>0
@@ -2417,15 +2417,15 @@ if the bottom is missing, it is the same as the top; if the right is missing,
24172417
it is the same as the top.
24182418

24192419
<dl dfn-for=border-image-outset dfn-type=value>
2420-
<dt><<length>>
2420+
<dt><<length [0,&infin;]>>
24212421
<dd>Represents an outset of the specified length.
2422-
Negative values are invalid.
24232422

2424-
<dt><<number>>
2423+
<dt><<number [0,&infin;]>>
24252424
<dd>Represents an outset of the specified multiple of the corresponding computed <a href="#the-border-width">border-width</a>.
2426-
Negative values are invalid.
24272425
</dl>
24282426

2427+
<p>Negative values are not allowed.
2428+
24292429
<p>Portions of the border-image that are rendered outside the border
24302430
box do not trigger scrolling. Also such portions are invisible to mouse
24312431
events and do not capture such events on behalf of the element.</p>
@@ -2671,7 +2671,7 @@ has been moved to the <a href="https://www.w3.org/TR/css3-break/">CSS Fragmentat
26712671
represented by 2-4 length values, an optional color, and an optional ''box-shadow/inset'' keyword.
26722672
Omitted lengths are 0; omitted colors default to the value of the 'color' property.
26732673
<pre class=prod>
2674-
<dfn><<shadow>></dfn> = <<color>>? &amp;&amp; <<length>>{2,4} &amp;&amp; inset?</pre>
2674+
<dfn><<shadow>></dfn> = <<color>>? &amp;&amp; [<<length>>{2} <<length [0,&infin;]>>? <<length>>?] &amp;&amp; inset?</pre>
26752675

26762676
<p>The components of each <<shadow>> are interpreted as follows:
26772677

@@ -2687,7 +2687,7 @@ has been moved to the <a href="https://www.w3.org/TR/css3-break/">CSS Fragmentat
26872687
Specifies the <dfn>vertical offset</dfn> of the shadow.
26882688
A positive value offsets the shadow down, a negative one up.
26892689

2690-
<dt><dfn id="shadow-blur-radius">3rd <<length>></dfn>
2690+
<dt><dfn id="shadow-blur-radius">3rd <<length [0,&infin;]>></dfn>
26912691
<dd>Specifies the <dfn>blur radius</dfn>.
26922692
Negative values are not allowed.
26932693
If the blur value is zero, the shadow’s edge is sharp.
@@ -3020,6 +3020,9 @@ Changes since the 17 October 2017 Candidate Recommendation</h3>
30203020
<li>
30213021
Cleaned up and regularized “Animation type” and “Computed value” lines
30223022
in the property definition tables.
3023+
<li>
3024+
Changed syntax to use <a>bracketed range notation</a>
3025+
to reflect the prose restrictions on negative values.
30233026
</ul>
30243027

30253028
<h3 id="changes-2014-09">

css-backgrounds-4/Overview.bs

+4-4
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Corner Sizing: the 'border-radius property</h3>
241241

242242
<pre class="propdef">
243243
Name: border-radius
244-
Value: <<length-percentage>>{1,4} [ / <<length-percentage>>{1,4} ]?
244+
Value: <<length-percentage [0,&infin;]>>{1,4} [ / <<length-percentage [0,&infin;]>>{1,4} ]?
245245
Initial: 0
246246
Applies to: all elements, except table element when 'border-collapse' is ''collapse''
247247
Inherited: no
@@ -357,8 +357,8 @@ Partial Borders: the 'border-limit' property</h3>
357357

358358
<pre class="propdef">
359359
Name: border-limit
360-
Value: all | [ sides | corners ] <<length-percentage>>?
361-
| [ top | right | bottom | left ] <<length-percentage>>
360+
Value: all | [ sides | corners ] <<length-percentage [0,&infin;]>>?
361+
| [ top | right | bottom | left ] <<length-percentage [0,&infin;]>>
362362
Initial: round
363363
Applies to: all elements, except table element when 'border-collapse' is ''collapse''
364364
Inherited: no
@@ -413,7 +413,7 @@ The 'border-clip' properties</h3>
413413

414414
<pre class="propdef">
415415
Name: border-clip, border-clip-top, border-clip-right, border-clip-bottom, border-clip-left
416-
Value: normal | [ <<length-percentage>> | <<flex>> ]+
416+
Value: normal | [ <<length-percentage [0,&infin;]>> | <<flex>> ]+
417417
Initial: normal
418418
Inherited: no
419419
Percentages: refer to length of border-edge side

css-counter-styles-3/Overview.bs

+7-6
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ Zero-Padding and Constant-Width Representations: the 'pad' descriptor</h3>
911911
<pre class='descdef'>
912912
Name: pad
913913
For: @counter-style
914-
Value: <<integer>> && <<symbol>>
914+
Value: <<integer [0,&infin;]>> && <<symbol>>
915915
Initial: 0 ""
916916
</pre>
917917

@@ -920,7 +920,7 @@ Zero-Padding and Constant-Width Representations: the 'pad' descriptor</h3>
920920
Representations larger than the specified pad value are constructed as normal.
921921

922922
<dl>
923-
<dt><<integer>> &amp;&amp; <<symbol>>
923+
<dt><<integer [0,&infin;]>> &amp;&amp; <<symbol>>
924924
<dd>
925925
The <<integer>> specifies a minimum length that all counter representations must reach.
926926

@@ -936,8 +936,7 @@ Zero-Padding and Constant-Width Representations: the 'pad' descriptor</h3>
936936
If <var>difference</var> is greater than zero,
937937
prepend <var>difference</var> copies of the specified <<symbol>> to the representation.
938938

939-
The <<integer>> must be non-negative.
940-
A negative value is a syntax error.
939+
Negative <<integer>> values are not allowed.
941940

942941
</dl>
943942

@@ -1030,7 +1029,7 @@ Marker characters: the 'symbols' and 'additive-symbols' descriptors</h3>
10301029
<pre class='descdef'>
10311030
Name: additive-symbols
10321031
For: @counter-style
1033-
Value: [ <<integer>> &amp;&amp; <<symbol>> ]#
1032+
Value: [ <<integer [0,&infin;]>> &amp;&amp; <<symbol>> ]#
10341033
Initial: n/a
10351034
</pre>
10361035

@@ -1054,7 +1053,7 @@ Marker characters: the 'symbols' and 'additive-symbols' descriptors</h3>
10541053
Each entry in the 'symbols' descriptor's value defines a <dfn export>counter symbol</dfn>,
10551054
which is interpreted differently based on the counter style's system.
10561055
Each entry in the 'additive-symbols' descriptor's value defines an <dfn export>additive tuple</dfn>,
1057-
which consists of a <a>counter symbol</a> and a non-negative integer weight.
1056+
which consists of a <a>counter symbol</a> and an integer weight.
10581057
Each weight must be a non-negative integer,
10591058
and the <a>additive tuples</a> must be specified in order of strictly descending weight;
10601059
otherwise, the declaration is invalid and must be ignored.
@@ -2623,6 +2622,8 @@ Changes since the Jun 2015 Candidate Recommendation</h3>
26232622
* Specified that invalid values just invalidate the declaration, not the whole rule.
26242623
* ''@counter-style'' rules that are invalid due to missing descriptors just fail to create a <a>counter style</a>;
26252624
they're otherwise still valid rules.
2625+
* Changed syntax to use <a>bracketed range notation</a> to reflect
2626+
the prose restrictions on negative values.
26262627

26272628
A <a href="https://drafts.csswg.org/css-counter-styles-3/issues-cr-20150611">Disposition of Comments</a> is available.
26282629

css-flexbox-1/Overview.bs

+12-8
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ The 'flex' Shorthand</h3>
16471647
<dl dfn-type=value dfn-for=flex>
16481648
<dt><dfn><<'flex-grow'>></dfn>
16491649
<dd>
1650-
This <<number>> component sets 'flex-grow' <a href="#flex-components">longhand</a>
1650+
This <<number [0,&infin;]>> component sets 'flex-grow' <a href="#flex-components">longhand</a>
16511651
and specifies the <dfn dfn>flex grow factor</dfn>,
16521652
which determines how much the <a>flex item</a> will grow
16531653
relative to the rest of the <a>flex items</a> in the flex container
@@ -1700,7 +1700,7 @@ The 'flex' Shorthand</h3>
17001700

17011701
<dt><dfn><<'flex-shrink'>></dfn>
17021702
<dd>
1703-
This <<number>> component sets 'flex-shrink' <a href="#flex-components">longhand</a>
1703+
This <<number [0,&infin;]>> component sets 'flex-shrink' <a href="#flex-components">longhand</a>
17041704
and specifies the <dfn dfn>flex shrink factor</dfn>,
17051705
which determines how much the <a>flex item</a> will shrink
17061706
relative to the rest of the <a>flex items</a> in the flex container
@@ -1823,9 +1823,9 @@ Basic Values of 'flex'</h4>
18231823
except that flex items are not allowed to shrink,
18241824
even in overflow situations.
18251825

1826-
<dt>''flex: &lt;positive-number>''
1826+
<dt>''flex: <<number [1,&infin;]>>''
18271827
<dd>
1828-
Equivalent to ''flex: &lt;positive-number> 1 0''.
1828+
Equivalent to ''flex: <<number [1,&infin;]>> 1 0''.
18291829
Makes the flex item flexible and sets the <a>flex basis</a> to zero,
18301830
resulting in an item that receives the specified proportion of the free space in the flex container.
18311831
If all items in the flex container use this pattern,
@@ -1852,7 +1852,7 @@ The 'flex-grow' property</h4>
18521852

18531853
<pre class='propdef'>
18541854
Name: flex-grow
1855-
Value: <<number>>
1855+
Value: <<number [0,&infin;]>>
18561856
Initial: 0
18571857
Applies to: <a>flex items</a>
18581858
Inherited: no
@@ -1867,14 +1867,14 @@ The 'flex-grow' property</h4>
18671867

18681868
The 'flex-grow' property sets the <a>flex grow factor</a>
18691869
to the provided <dfn value for=flex-grow><<number>></dfn>.
1870-
Negative numbers are invalid.
1870+
Negative values are not allowed.
18711871

18721872
<h4 id='flex-shrink-property'>
18731873
The 'flex-shrink' property</h4>
18741874

18751875
<pre class='propdef'>
18761876
Name: flex-shrink
1877-
Value: <<number>>
1877+
Value: <<number [0,&infin;]>>
18781878
Initial: 1
18791879
Applies to: <a>flex items</a>
18801880
Inherited: no
@@ -1889,7 +1889,7 @@ The 'flex-shrink' property</h4>
18891889

18901890
The 'flex-shrink' property sets the <a>flex shrink factor</a>
18911891
to the provided <dfn value for=flex-shrink><<number>></dfn>.
1892-
Negative numbers are invalid.
1892+
Negative values are not allowed.
18931893

18941894
<h4 id='flex-basis-property'>
18951895
The 'flex-basis' property</h4>
@@ -3697,9 +3697,13 @@ Boris Zbarsky.
36973697
This section documents the changes since previous publications.
36983698

36993699
<h3 id="changes-20181119">
3700+
37003701
Changes since the <a href="https://www.w3.org/TR/2018/CR-css-flexbox-1-20181119/">19 November 2018 CR</a></h3>
37013702

37023703
<ul>
3704+
<li id="change-2019-bracket-range-notation">
3705+
Changed syntax to use <a>bracketed range notation</a> to reflect the prose restrictions on negative values.
3706+
37033707
<li id="change-2018-used-cross-size">
37043708
Clarified that the [=flex base size=] calculations
37053709
rely on the <em>used</em> [=cross size=].

0 commit comments

Comments
 (0)