8000 [css-syntax] Add "Parse a list of rules" and "Parse a declaration". · xfq/csswg-drafts@c56f83c · GitHub
Skip to content

Commit c56f83c

Browse files
committed
[css-syntax] Add "Parse a list of rules" and "Parse a declaration".
1 parent 5e49e2e commit c56f83c

2 files changed

Lines changed: 137 additions & 21 deletions

File tree

css-syntax/Overview.html

Lines changed: 100 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -250,17 +250,23 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
250250
<li><a href="#parse-a-stylesheet"><span class=secno>5.3.1. </span>
251251
Parse a stylesheet</a>
252252

253-
<li><a href="#parse-a-rule"><span class=secno>5.3.2. </span> Parse a
253+
<li><a href="#parse-a-list-of-rules"><span class=secno>5.3.2. </span>
254+
Parse a list of rules</a>
255+
256+
<li><a href="#parse-a-rule"><span class=secno>5.3.3. </span> Parse a
254257
rule</a>
255258

256-
<li><a href="#parse-a-list-of-declarations"><span class=secno>5.3.3.
259+
<li><a href="#parse-a-declaration"><span class=secno>5.3.4. </span>
260+
Parse a declaration</a>
261+
262+
<li><a href="#parse-a-list-of-declarations"><span class=secno>5.3.5.
257263
</span> Parse a list of declarations</a>
258264

259-
<li><a href="#parse-a-component-value"><span class=secno>5.3.4.
265+
<li><a href="#parse-a-component-value"><span class=secno>5.3.6.
260266
</span> Parse a component value</a>
261267

262268
<li><a href="#parse-a-list-of-component-values"><span
263-
class=secno>5.3.5. </span> Parse a list of component values</a>
269+
class=secno>5.3.7. </span> Parse a list of component values</a>
264270
</ul>
265271

266272
<li><a href="#parser-algorithms"><span class=secno>5.4. </span> Parser
@@ -2948,6 +2954,14 @@ <h3 id=parser-entry-points><span class=secno>5.3. </span> Parser Entry
29482954
preprocessing</a> to produce a character stream, then perform <a
29492955
href="#tokenization">tokenization</a> to produce a token stream.
29502956

2957+
<p> "<a href="#parse-a-stylesheet0"><i>Parse a stylesheet</i></a>" can
2958+
also be invoked on a byte stream, in which case <a
2959+
href="#the-input-byte-stream">The input byte stream</a> defines how to
2960+
decode it into Unicode.
2961+
2962+
<p class=note> This specification does not define how a byte stream is
2963+
decoded for other entry points.
2964+
29512965
<p class=note> Other specs can define additional entry points for their
29522966
own purposes.
29532967

@@ -2960,11 +2974,22 @@ <h3 id=parser-entry-points><span class=secno>5.3. </span> Parser Entry
29602974
is intended to be the normal parser entry point, for parsing
29612975
stylesheets.
29622976

2977+
<li> "<a href="#parse-a-list-of-rules0"><i>Parse a list of
2978+
rules</i></a>" is intended for the content of at-rules such as
2979+
<code class=css>@media</code>’. It differs from "<a
2980+
href="#parse-a-stylesheet0"><i>Parse a stylesheet</i></a>" in the
2981+
handling of 〈CDO〉 and 〈CDC〉.
2982+
29632983
<li> "<a href="#parse-a-rule0"><i>Parse a rule</i></a>" is intended
29642984
for use by the <code>CSSStyleSheet#insertRule</code> method, and
29652985
similar functions which might exist, which parse text into a single
29662986
rule.
29672987

2988+
<li> "<a href="#parse-a-declaration0"><i>Parse a declaration</i></a>"
2989+
is used in ‘<code class=css>@supports</code>’ conditions. <a
2990+
href="#CSS3-CONDITIONAL"
2991+
rel=biblioentry>[CSS3-CONDITIONAL]<!--{{CSS3-CONDITIONAL}}--></a>
2992+
29682993
<li> "<a href="#parse-a-list-of-declarations0"><i>Parse a list of
29692994
declarations</i></a>" is for the contents of a <code>style</code>
29702995
attribute, which parses text into the contents of a single style
@@ -2976,7 +3001,13 @@ <h3 id=parser-entry-points><span class=secno>5.3. </span> Parser Entry
29763001

29773002
<li> "<a href="#parse-a-list-of-component-values0"><i>Parse a list of
29783003
component values</i></a>" is for the contents of presentational
2979-
attributes, which parse text into a single declaration's value.
3004+
attributes, which parse text into a single declaration's value, or
3005+
for parsing a stand-alone selector <a href="#SELECT"
3006+
rel=biblioentry>[SELECT]<!--{{SELECT}}--></a> or list of Media
3007+
Queries <a href="#MEDIAQ"
3008+
rel=biblioentry>[MEDIAQ]<!--{{MEDIAQ}}--></a>, as in <a
3009+
href="http://www.w3.org/TR/selectors-api/">Selectors API</a> or the
3010+
<code>media</code> HTML attribute.
29803011
</ul>
29813012
</div>
29823013

@@ -2994,15 +3025,28 @@ <h4 id=parse-a-stylesheet><span class=secno>5.3.1. </span> <dfn
29943025
<li> Create a new stylesheet.
29953026

29963027
<li> <a href="#consume-a-list-of-rules0"><i>Consume a list of
2997-
rules</i></a> from the stream of tokens, with the <var>top-level
2998-
flag</var> set.
3028+
rules</i></a> from the stream of tokens, with the <a
3029+
href="#top-level-flag"><var>top-level flag</var></a> set.
29993030

30003031
<li> Assign the returned value to the stylesheet's value.
30013032

30023033
<li> Return the stylesheet.
30033034
</ol>
30043035

3005 1337 -
<h4 id=parse-a-rule><span class=secno>5.3.2. </span> <dfn
3036+
<h4 id=parse-a-list-of-rules><span class=secno>5.3.2. </span> <dfn
3037+
id=parse-a-list-of-rules0>Parse a list of rules</dfn></h4>
3038+
3039+
<p> To <a href="#parse-a-list-of-rules0"><i>parse a list of
3040+
rules</i></a> from a stream of tokens:
3041+
3042+
<ol>
3043+
<li> <a href="#consume-a-list-of-rules0"><i>Consume a list of
3044+
rules</i></a> from the stream of tokens, with the <a
3045+
href="#top-level-flag"><var>top-level flag</var></a> unset. Return
3046+
the returned list.
3047+
</ol>
3048+
3049+
<h4 id=parse-a-rule><span class=secno>5.3.3. </span> <dfn
30063050
id=parse-a-rule0>Parse a rule</dfn></h4>
30073051

30083052
<p> To <a href="#parse-a-rule0"><i>parse a rule</i></a> from a stream
@@ -3031,7 +3075,18 @@ <h4 id=parse-a-rule><span class=secno>5.3.2. </span> <dfn
30313075
Otherwise, return a syntax error.
30323076
</ol>
30333077

3034-
<h4 id=parse-a-list-of-declarations><span class=secno>5.3.3. </span>
3078+
<h4 id=parse-a-declaration><span class=secno>5.3.4. </span> <dfn
3079+
id=parse-a-declaration0>Parse a declaration</dfn></h4>
3080+
3081+
<p> To <a href="#parse-a-declaration0"><i>parse a declaration</i></a>:
3082+
3083+
<ol>
3084+
<li> <a href="#consume-a-declaration0"><i>Consume a
3085+
declaration</i></a>. If anything was returned, return it. Otherwise,
3086+
return a syntax error.
3087+
</ol>
3088+
3089+
<h4 id=parse-a-list-of-declarations><span class=secno>5.3.5. </span>
30353090
<dfn id=parse-a-list-of-declarations0>Parse a list of
30363091
declarations</dfn></h4>
30373092

@@ -3040,10 +3095,10 @@ <h4 id=parse-a-list-of-declarations><span class=secno>5.3.3. </span>
30403095

30413096
<ol>
30423097
<li> <a href="#consume-a-list-of-declarations0"><i>Consume a list of
3043-
declarations</i></a>. If anything was returned, return it.
3098+
declarations</i></a>. Return the returned list.
30443099
</ol>
30453100

3046-
<h4 id=parse-a-component-value>< 6D57 /span><span class=secno>5.3.4. </span> <dfn
3101+
<h4 id=parse-a-component-value><span class=secno>5.3.6. </span> <dfn
30473102
id=parse-a-component-value0>Parse a component value</dfn></h4>
30483103

30493104
<p> To <a href="#parse-a-component-value0"><i>parse a component
@@ -3063,7 +3118,7 @@ <h4 id=parse-a-component-value><span class=secno>5.3.4. </span> <dfn
30633118
previous step. Otherwise, return a syntax error.
30643119
</ol>
30653120

3066-
<h4 id=parse-a-list-of-component-values><span class=secno>5.3.5.
3121+
<h4 id=parse-a-list-of-component-values><span class=secno>5.3.7.
30673122
</span> <dfn id=parse-a-list-of-component-values0>Parse a list of
30683123
component values</dfn></h4>
30693124

@@ -3117,7 +3172,8 @@ <h4 id=consume-a-list-of-rules><span class=secno>5.4.1. </span> <dfn
31173172

31183173
<dt>〈CDC〉
31193174

3120-
<dd> If the <var>top-level flag</var> is set, do nothing.
3175+
<dd> If the <dfn id=top-level-flag><var>top-level flag</var></dfn> is
3176+
set, do nothing.
31213177
<p> Otherwise, <a
31223178
href="#reconsume-the-current-input-token"><i>reconsume the current
31233179
input token</i></a>. <a href="#consume-a-qualified-rule0"><i>Consume
@@ -4185,6 +4241,25 @@ <h3 class=no-num id=other-references> Other references</h3>
41854241
style="display: none"><!-- keeps the doc valid if the DL is empty -->
41864242
<!---->
41874243

4244+
<dt id=CSS3-CONDITIONAL>[CSS3-CONDITIONAL]
4245+
4246+
<dd>L. David Baron. <a
4247+
href="http://www.w3.org/TR/2013/CR-css3-conditional-20130404/"><cite>CSS
4248+
Conditional Rules Module Level 3.</cite></a> 4 April 2013. W3C
4249+
Candidate Recommendation. (Work in progress.) URL: <a
4250+
href="http://www.w3.org/TR/2013/CR-css3-conditional-20130404/">http://www.w3.org/TR/2013/CR-css3-conditional-20130404/</a>
4251+
</dd>
4252+
<!---->
4253+
4254+
<dt id=MEDIAQ>[MEDIAQ]
4255+
4256+
<dd>Florian Rivoal. <a
4257+
href="http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/"><cite>Media
4258+
Queries.</cite></a> 19 June 2012. W3C Recommendation. URL: <a
4259+
href="http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/">http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/</a>
4260+
</dd>
4261+
<!---->
4262+
41884263
<dt id=SELECT>[SELECT]
41894264

41904265
<dd>Tantek Çelik; et al. <a
@@ -4386,19 +4461,25 @@ <h2 class=no-num id=index> Index</h2>
43864461
title="section 4.2."><strong>4.2.</strong></a>
43874462

43884463
<li>Parse a component value, <a href="#parse-a-component-value0"
4464+
title="section 5.3.6."><strong>5.3.6.</strong></a>
4465+
4466+
<li>Parse a declaration, <a href="#parse-a-declaration0"
43894467
title="section 5.3.4."><strong>5.3.4.</strong></a>
43904468

43914469
<li>Parse a list of component values, <a
43924470
href="#parse-a-list-of-component-values0"
4393-
title="section 5.3.5."><strong>5.3.5.</strong></a>
4471+
title="section 5.3.7."><strong>5.3.7.</strong></a>
43944472

43954473
<li>Parse a list of declarations, <a
43964474
href="#parse-a-list-of-declarations0"
4397-
title="section 5.3.3."><strong>5.3.3.</strong></a>
4475+
title="section 5.3.5."><strong>5.3.5.</strong></a>
43984476

4399-
<li>Parse a rule, <a href="#parse-a-rule0"
4477+
<li>Parse a list of rules, <a href="#parse-a-list-of-rules0"
44004478
title="section 5.3.2."><strong>5.3.2.</strong></a>
44014479

4480+
<li>Parse a rule, <a href="#parse-a-rule0"
4481+
title="section 5.3.3."><strong>5.3.3.</strong></a>
4482+
44024483
<li>Parse a stylesheet, <a href="#parse-a-stylesheet0"
44034484
title="section 5.3.1."><strong>5.3.1.</strong></a>
44044485

@@ -4471,6 +4552,9 @@ <h2 class=no-num id=index> Index</h2>
44714552
title="section 10.2."><strong>10.2.</strong></a>
44724553
</ul>
44734554

4555+
<li><var>top-level flag</var>, <a href="#top-level-flag"
4556+
title="section 5.4.1."><strong>5.4.1.</strong></a>
4557+
44744558
<li>uppercase letter, <a href="#uppercase-letter"
44754559
title="section 4.2."><strong>4.2.</strong></a>
44764560

css-syntax/Overview.src.html

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,11 +1934,18 @@ <h3>
19341934
"<i>Parse a stylesheet</i>" is intended to be the normal parser entry point,
19351935
for parsing stylesheets.
19361936

1937+
<li>
1938+
"<i>Parse a list of rules</i>" is intended for the content of at-rules such as ''@media''.
1939+
It differs from "<i>Parse a stylesheet</i>" in the handling of 〈CDO〉 and 〈CDC〉.
1940+
19371941
<li>
19381942
"<i>Parse a rule</i>" is intended for use by the <code>CSSStyleSheet#insertRule</code> method,
19391943
and similar functions which might exist,
19401944
which parse text into a single rule.
19411945

1946+
<li>
1947+
"<i>Parse a declaration</i>" is used in ''@supports'' conditions. [[CSS3-CONDITIONAL]]
1948+
19421949
<li>
19431950
"<i>Parse a list of declarations</i>" is for the contents of a <code>style</code> attribute,
19441951
which parses text into the contents of a single style rule.
@@ -1949,7 +1956,10 @@ <h3>
19491956

19501957
<li>
19511958
"<i>Parse a list of component values</i>" is for the contents of presentational attributes,
1952-
which parse text into a single declaration's value.
1959+
which parse text into a single declaration's value,
1960+
or for parsing a stand-alone selector [[SELECT]] or list of Media Queries [[MEDIAQ]],
1961+
as in <a href="http://www.w3.org/TR/selectors-api/">Selectors API</a>
1962+
or the <code>media</code> HTML attribute.
19531963
</ul>
19541964
</div>
19551965

@@ -1978,6 +1988,17 @@ <h4>
19781988
Return the stylesheet.
19791989
</ol>
19801990

1991+
<h4>
1992+
<dfn>Parse a list of rules</dfn></h4>
1993+
1994+
<p>
1995+
To <i>parse a list of rules</i> from a stream of tokens:
1996+
1997+
<ol>
1998+
<li>
1999+
<i>Consume a list of rules</i> from the stream of tokens, with the <var>top-level flag</var> unset. Return the returned list.
2000+
</ol>
2001+
19812002
<h4>
19822003
<dfn>Parse a rule</dfn></h4>
19832004

@@ -2013,6 +2034,19 @@ <h4>
20132034
Otherwise, return a syntax error.
20142035
</ol>
20152036

2037+
<h4>
2038+
<dfn>Parse a declaration</dfn></h4>
2039+
2040+
<p>
2041+
To <i>parse a declaration</i>:
2042+
2043+
<ol>
2044+
<li>
2045+
<i>Consume a declaration</i>.
2046+
If anything was returned, return it.
2047+
Otherwise, return a syntax error.
2048+
</ol>
2049+
20162050
<h4>
20172051
<dfn>Parse a list of declarations</dfn></h4>
20182052

@@ -2021,9 +2055,7 @@ <h4>
20212055

20222056
<ol>
20232057
<li>
2024-
<i>Consume a list of declarations</i>.
2025-
If anything was returned,
2026-
return it.
2058+
<i>Consume a list of declarations</i>. Return the returned list.
20272059
</ol>
20282060

20292061
<h4>
@@ -2107,7 +2139,7 @@ <h4>
21072139
<dt>〈CDO〉
21082140
<dt>〈CDC〉
21092141
<dd>
2110-
If the <var>top-level flag</var> is set,
2142+
If the <dfn><var>top-level flag</var></dfn> is set,
21112143
do nothing.
21122144

21132145
<p>

0 commit comments

Comments
 (0)