Skip to content

Commit 2f7c95b

Browse files
committed
Specify serialization algorithm for CSS style declaration block (i.e., for CSSStyleDeclarations).
1 parent 088001f commit 2f7c95b

3 files changed

Lines changed: 54 additions & 8 deletions

File tree

cssom/Overview.html

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,11 +1859,34 @@ <h3 id="css-declaration-blocks"><span class="secno">6.5 </span>CSS Declaration B
18591859
<dfn id="parse-a-css-declaration-block">parse a CSS declaration block</dfn>
18601860
...</p>
18611861

1862-
<p class="issue">To
1863-
<dfn id="serialize-a-css-declaration-block">serialize a CSS declaration block</dfn>
1864-
...</p>
1862+
<p>To <dfn id="serialize-a-css-declaration-block">serialize a CSS declaration block</dfn>
1863+
represented by a <code>CSSStyleDeclarations</code> instance named <var>d</var>,
1864+
let <var>s</var> be the empty string, then run the steps below:</p>
1865+
1866+
<ol>
1867+
<li><p>If <code><var>d</var>.length</code> is zero (0), then return <var>s</var>.</li>
1868+
<li><p>For each <var>i</var> from zero (0) through <code><var>d</var>.length</code> - 1 (inclusive), perform the following sub-steps:</p>
1869+
<ol>
1870+
<li><p>Let <var>n</var> be the value returned by <code><var>d</var>.item(<var>i</var>)</code>.</li>
1871+
<li><p>Let <var>v</var> be the value returned by <code><var>d</var>.getPropertyValue(<var>n</var>)</code>.</li>
1872+
<li><p>If <var>v</var> is the empty string, then continue.</li>
1873+
<li><p>Otherwise (<var>v</var> is non-empty), perform the following sub-steps:</p>
1874+
<ol>
1875+
<li><p>If <var>s</var> is not empty, then append a SPACE (U+0020) to <var>s</var>.</li>
1876+
<li><p>Append <var>n</var> to <var>s</var>.</li>
1877+
<li><p>Append COLON (U+003A) followed by SPACE (U+0020, i.e., "<code>: </code>", to <var>s</var>.</li>
1878+
<li><p>Append <var>v</var> to <var>s</var>.</li>
1879+
<li><p>Append SEMICOLON (U+003B), i.e., "<code>;</code>", to <var>s</var>.</li>
1880+
</ol>
1881+
</li>
1882+
</ol>
1883+
</li>
1884+
</ol>
18651885

1886+
<p class="note">The serialization of an empty CSS declaration block is the empty string.</p>
18661887

1888+
<p class="note">The serialization of an non-empty CSS declaration block does not including any surrounding whitespace, i.e., no whitepsace
1889+
before the first property name and no whitespace after the final semicolon delimiter that follows the last property value..</p>
18671890

18681891
<!-- ........................................................................................................................ -->
18691892

@@ -1898,7 +1921,7 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
18981921
<dt class="method" id="widl-CSSStyleDeclaration-item-DOMString-unsigned-long-index">
18991922
<code>item</code> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span></span>), returns <span class="idlMethType"><a>DOMString</a></span></dt>
19001923
<dd>
1901-
<p>The <code>item</code> operation must return the property at position <var>index</var>.</dd>
1924+
<p>The <code>item</code> operation must return the name of the property at position <var>index</var>.</dd>
19021925
<dt class="method" id="widl-CSSStyleDeclaration-getPropertyValue-DOMString-DOMString-property">
19031926
<code>getPropertyValue</code> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span></span>), returns <span class="idlMethType"><a>DOMString</a></span></dt>
19041927
<dd>

cssom/cssom-source

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,11 +1463,34 @@
14631463
<dfn id="parse-a-css-declaration-block">parse a CSS declaration block</dfn>
14641464
...</p>
14651465

1466-
<p class="issue">To
1467-
<dfn id="serialize-a-css-declaration-block">serialize a CSS declaration block</dfn>
1468-
...</p>
1466+
<p>To <dfn id="serialize-a-css-declaration-block">serialize a CSS declaration block</dfn>
1467+
represented by a <code>CSSStyleDeclarations</code> instance named <var>d</var>,
1468+
let <var>s</var> be the empty string, then run the steps below:</p>
1469+
1470+
<ol>
1471+
<li><p>If <code><var>d</var>.length</code> is zero (0), then return <var>s</var>.</p></li>
1472+
<li><p>For each <var>i</var> from zero (0) through <code><var>d</var>.length</code> - 1 (inclusive), perform the following sub-steps:</p>
1473+
<ol>
1474+
<li><p>Let <var>n</var> be the value returned by <code><var>d</var>.item(<var>i</var>)</code>.</p></li>
1475+
<li><p>Let <var>v</var> be the value returned by <code><var>d</var>.getPropertyValue(<var>n</var>)</code>.</p></li>
1476+
<li><p>If <var>v</var> is the empty string, then continue.</p></li>
1477+
<li><p>Otherwise (<var>v</var> is non-empty), perform the following sub-steps:</p>
1478+
<ol>
1479+
<li><p>If <var>s</var> is not empty, then append a SPACE (U+0020) to <var>s</var>.</p></li>
1480+
<li><p>Append <var>n</var> to <var>s</var>.</p></li>
1481+
<li><p>Append COLON (U+003A) followed by SPACE (U+0020, i.e., "<code>: </code>", to <var>s</var>.</p></li>
1482+
<li><p>Append <var>v</var> to <var>s</var>.</p></li>
1483+
<li><p>Append SEMICOLON (U+003B), i.e., "<code>;</code>", to <var>s</var>.</p></li>
1484+
</ol>
1485+
</li>
1486+
</ol>
1487+
</li>
1488+
</ol>
14691489

1490+
<p class="note">The serialization of an empty CSS declaration block is the empty string.</p>
14701491

1492+
<p class="note">The serialization of an non-empty CSS declaration block does not including any surrounding whitespace, i.e., no whitepsace
1493+
before the first property name and no whitespace after the final semicolon delimiter that follows the last property value..</p>
14711494

14721495
<!-- ........................................................................................................................ -->
14731496

cssom/idl/CSSStyleDeclaration.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface CSSStyleDeclaration {
3232
readonly attribute unsigned long length;
3333

3434
[Documentation=
35-
"<p>The {@name} {@type} must return the property at position <var>index</var>.</p>"
35+
"<p>The {@name} {@type} must return the name of the property at position <var>index</var>.</p>"
3636
]
3737
DOMString item(unsigned long index);
3838

0 commit comments

Comments
 (0)