Skip to content

Commit 9e8f26e

Browse files
committed
introduce serialize a comma-separated list
1 parent cde3af1 commit 9e8f26e

2 files changed

Lines changed: 58 additions & 107 deletions

File tree

cssom/Overview.html

Lines changed: 30 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,11 @@ <h3 id=common-serializing-idioms><span class=secno>2.3. </span>Common
406406
href="#serialize-a-string" title="serialize a string">string escaped</a>
407407
value of the given string, followed by "<code>)</code>".
408408

409+
<p>To <dfn id=serialize-a-comma-separated-list>serialize a comma-separated
410+
list</dfn> concatenate all items of the list in list order while
411+
separating them by "<code>,</code>" (U+002C), followed by a space
412+
(U+0020).
413+
409414
<h2 id=media-queries><span class=secno>3. </span>Media Queries</h2>
410415

411416
<p><dfn id="media queries">Media queries</dfn> are defined by the Media
@@ -436,21 +441,10 @@ <h3 id=serializing-media-queries><span class=secno>3.2. </span>Serializing
436441
Media Queries</h3>
437442

438443
<p>To <dfn id=serialize-a-list-of-media-queries>serialize a list of media
439-
queries</dfn> let <var title="">s</var> be the empty string, run the steps
440-
below for each media query in the list of media queries, and finally
441-
return <var title="">s</var>:
442-
443-
<ol>
444-
<li>
445-
<p>Append the result of <a href="#serialize-a-media-query"
446-
title="serialize a media query">serializing</a> the media query to <var
447-
title="">s</var>.
448-
449-
<li>
450-
<p>If this is not the last media query in the list append
451-
"<code>,</code>" (U+002C), followed by a space (U+0020), to <var
452-
title="">s</var>.
453-
</ol>
444+
queries</dfn> <a href="#serialize-a-media-query" title="serialize a media
445+
query">serialize</a> each media query in the list of media queries and
446+
then <a href="#serialize-a-comma-separated-list" title="serialize a
447+
comma-separated list">serialize</a> the list.
454448

455449
<p>To <dfn id=serialize-a-media-query>serialize a media query</dfn> let
456450
<var title="">s</var> be the empty string, run the steps below, and
@@ -779,20 +773,10 @@ <h3 id=serializing-selectors><span class=secno>4.2. </span>Serializing
779773
<!-- http://dump.testsuite.org/2009/cssom/serializing-selectors.htm -->
780774

781775
<p>To <dfn id=serialize-a-group-of-selectors>serialize a group of
782-
selectors</dfn> let <var title="">s</var> be the empty string, run the
783-
steps below for each selector in the group of selectors, and finally
784-
return <var title="">s</var>:
785-
786-
<ol>
787-
<li>
788-
<p>Append the result of <a href="#serialize-a-selector" title="serialize
789-
a selector">serializing</a> the selector to <var title="">s</var>.
790-
791-
<li>
792-
<p>If the selector is not the last selector in the group of selectors
793-
append "<code>,</code>" (U+002C), followed by a space (U+0020), to <var
794-
title="">s</var>.
795-
</ol>
776+
selectors</dfn> <a href="#serialize-a-selector" title="serialize a
777+
selector">serialize</a> each selector in the group of selectors and then
778+
<a href="#serialize-a-comma-separated-list" title="serialize a
779+
comma-separated list">serialize</a> the group.
796780

797781
<p>To <dfn id=serialize-a-selector>serialize a selector</dfn> let <var
798782
title="">s</var> be the empty string, run the steps below for each part of
@@ -3585,36 +3569,24 @@ <h4 id=serializing-css-values><span class=secno>5.6.2. </span>Serializing
35853569
<dt>&lt;counter>
35863570

35873571
<dd>
3588-
<p>In case of nested counters with the same name the concatenation of
3589-
these strings:</p>
3572+
<p>The concatenation of:</p>
35903573

35913574
<ol>
35923575
<li>
3593-
<p>The string "<code title="">counters(</code>", followed by the first
3594-
&lt;identifier> component, serialized, followed by "<code>,</code>"
3595-
(U+002C), followed by a space (U+0020), followed by the &lt;string>
3596-
component, serialized.
3597-
3598-
<li>
3599-
<p>If there is a second <&lt;identifier> component: "<code>,</code>"
3600-
(U+002C), followed by a space (U+0020), followed by the second
3601-
&lt;identifier> component, serialized.
3576+
<p>If &lt;counter> has three CSS value components the string "<code
3577+
title="">counters(</code>".
36023578

36033579
<li>
3604-
<p>"<code>)</code>" (U+0029).
3605-
</ol>
3606-
3607-
<p>Otherwise, the concatenation of these strings:</p>
3608-
3609-
<ol>
3610-
<li>
3611-
<p>The string "<code title="">counter(</code>", followed by the first
3612-
&lt;identifier> component, serialized.
3580+
<p>If &lt;counter> has two CSS value components the string "<code
3581+
title="">counter(</code>".
36133582

36143583
<li>
3615-
<p>If there is a second <&lt;identifier> component: "<code>,</code>"
3616-
(U+002C), followed by a space (U+0020), followed by the second
3617-
&lt;identifier> component, serialized.
3584+
<p>The result of <a href="#serialize-a-comma-separated-list"
3585+
title="serialize a comma-separated list">serializing</a> the <a
3586+
href="#serialize-a-css-value-component" title="serialize a CSS value
3587+
component">serialized</a> CSS value components belonging to
3588+
&lt;counter> as list while omitting the last CSS value component if it
3589+
is 'decimal'.
36183590

36193591
<li>
36203592
<p>"<code>)</code>" (U+0029).
@@ -3675,10 +3647,12 @@ <h4 id=serializing-css-values><span class=secno>5.6.2. </span>Serializing
36753647
<dt>&lt;shape>
36763648

36773649
<dd>
3678-
<p>The string "<code title="">rect(</code>". Then for each CSS value
3679-
component the component in serialized form, followed by "<code>,</code>"
3680-
(U+002C) and a space (U+0020) unless the component is the last in which
3681-
case follow it by "<code>)</code>" (U+0029).
3650+
<p>The string "<code title="">rect(</code>", followed by the result of <a
3651+
href="#serialize-a-comma-separated-list" title="serialize a
3652+
comma-separated list">serializing</a> the <a
3653+
href="#serialize-a-css-value-component" title="serialize a CSS value
3654+
component">serialized</a> CSS value components belonging to &lt;shape>
3655+
as list, followed by "<code>)</code>" (U+0029).
36823656

36833657
<dt>&lt;string>
36843658

cssom/Overview.src.html

Lines changed: 28 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ <h3>Common Serializing Idioms</h3>
214214
<span title="serialize a string">string escaped</span> value of the given
215215
string, followed by "<code>)</code>".</p>
216216

217+
<p>To <dfn>serialize a comma-separated list</dfn> concatenate all items of
218+
the list in list order while separating them by "<code>,</code>" (U+002C),
219+
followed by a space (U+0020).</p>
220+
217221

218222

219223
<h2>Media Queries</h2>
@@ -248,19 +252,10 @@ <h3>Serializing Media Queries</h3>
248252

249253
<p>To
250254
<dfn id="serialize-a-list-of-media-queries">serialize a list of media queries</dfn>
251-
let <var title="">s</var> be the empty string, run the steps below for
252-
each media query in the list of media queries, and finally return
253-
<var title="">s</var>:</p>
254-
255-
<ol>
256-
<li><p>Append the result of
257-
<span title="serialize a media query">serializing</span> the media query
258-
to <var title="">s</var>.</p></li>
259-
260-
<li><p>If this is not the last media query in the list append
261-
"<code>,</code>" (U+002C), followed by a space (U+0020), to
262-
<var title="">s</var>.</p></li>
263-
</ol>
255+
<span title="serialize a media query">serialize</span> each media query in
256+
the list of media queries and then
257+
<span title="serialize a comma-separated list">serialize</span> the
258+
list.</p>
264259

265260
<p>To
266261
<dfn id="serialize-a-media-query">serialize a media query</dfn> let
@@ -530,21 +525,11 @@ <h3>Serializing Selectors</h3>
530525

531526
<p>To
532527
<dfn id="serialize-a-group-of-selectors">serialize a group of selectors</dfn>
533-
let <var title="">s</var> be the empty string, run the steps below for
534-
each selector in the group of selectors, and finally return
535-
<var title="">s</var>:</p>
536-
537-
<ol>
538-
<li><p>Append the result of
539-
<span title="serialize a selector">serializing</span> the selector to
540-
<var title="">s</var>.</p></li>
541-
542-
<li><p>If the selector is not the last selector in the group of selectors
543-
append "<code>,</code>" (U+002C), followed by a space (U+0020), to
544-
<var title="">s</var>.</p></li>
545-
</ol>
546-
547-
528+
<span title="serialize a selector">serialize</span> each selector in the
529+
group of selectors and then
530+
<span title="serialize a comma-separated list">serialize</span> the
531+
group.</p>
532+
548533
<p>To <dfn id="serialize-a-selector">serialize a selector</dfn> let
549534
<var title="">s</var> be the empty string, run the steps below for each
550535
part of the chain of the selector, and finally return
@@ -2254,26 +2239,17 @@ <h4>Serializing CSS Values</h4>
22542239

22552240
<dt>&lt;counter></dt>
22562241
<dd>
2257-
<p>In case of nested counters with the same name the concatenation of
2258-
these strings:</p>
2259-
<ol>
2260-
<li><p>The string "<code title="">counters(</code>", followed by the
2261-
first &lt;identifier> component, serialized, followed by
2262-
"<code>,</code>" (U+002C), followed by a space (U+0020), followed by
2263-
the &lt;string> component, serialized.</p></li>
2264-
<li><p>If there is a second <&lt;identifier> component:
2265-
"<code>,</code>" (U+002C), followed by a space (U+0020), followed by
2266-
the second &lt;identifier> component, serialized.</p></li>
2267-
<li><p>"<code>)</code>" (U+0029).</p></li>
2268-
</ol>
2269-
2270-
<p>Otherwise, the concatenation of these strings:</p>
2242+
<p>The concatenation of:</p>
22712243
<ol>
2272-
<li><p>The string "<code title="">counter(</code>", followed by the
2273-
first &lt;identifier> component, serialized.</p></li>
2274-
<li><p>If there is a second <&lt;identifier> component:
2275-
"<code>,</code>" (U+002C), followed by a space (U+0020), followed by
2276-
the second &lt;identifier> component, serialized.</p></li>
2244+
<li><p>If &lt;counter> has three CSS value components the string
2245+
"<code title="">counters(</code>".</p></li>
2246+
<li><p>If &lt;counter> has two CSS value components the string
2247+
"<code title="">counter(</code>".</p></li>
2248+
<li><p>The result of
2249+
<span title="serialize a comma-separated list">serializing</span> the
2250+
<span title="serialize a CSS value component">serialized</span>
2251+
CSS value components belonging to &lt;counter> as list while omitting
2252+
the last CSS value component if it is 'decimal'.</p></li>
22772253
<li><p>"<code>)</code>" (U+0029).</p></li>
22782254
</ol>
22792255
</dd>
@@ -2320,10 +2296,11 @@ <h4>Serializing CSS Values</h4>
23202296
&lt;number> followed by the literal string "<code>dpcm</code>".</dd>
23212297

23222298
<dt>&lt;shape></dt>
2323-
<dd><p>The string "<code title="">rect(</code>". Then for each
2324-
CSS value component the component in serialized form, followed by
2325-
"<code>,</code>" (U+002C) and a space (U+0020) unless the component is
2326-
the last in which case follow it by "<code>)</code>" (U+0029).</p></dd>
2299+
<dd><p>The string "<code title="">rect(</code>", followed by the result
2300+
of <span title="serialize a comma-separated list">serializing</span> the
2301+
<span title="serialize a CSS value component">serialized</span>
2302+
CSS value components belonging to &lt;shape> as list, followed by
2303+
"<code>)</code>" (U+0029).</p></dd>
23272304

23282305
<dt>&lt;string></dt>
23292306
<dt>&lt;family-name></dt>

0 commit comments

Comments
 (0)