Skip to content

Commit 19dabdb

Browse files
author
Simon Pieters
committed
[cssom] Make 'parse a CSS declaration block' drop invalid stuff, and move that step from 'insert a CSS rule' to 'parse a CSS rule'.
--HG-- extra : rebase_source : fe4abcc1872e73fcd4943936ce55dc4e4422c223
1 parent a53ef02 commit 19dabdb

2 files changed

Lines changed: 46 additions & 14 deletions

File tree

cssom/Overview.html

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<h1>CSS Object Model (CSSOM)</h1>
1717

1818

19-
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 2 September 2013</h2>
19+
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 5 September 2013</h2>
2020

2121
<dl>
2222

@@ -90,7 +90,7 @@ <h2 class="no-num no-toc" id="sotd">Status of This Document</h2>
9090
can be found in the
9191
<a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em>
9292

93-
<p class="dontpublish">This is the 2 September 2013 Editor's Draft of CSSOM. Please send comments to
93+
<p class="dontpublish">This is the 5 September 2013 Editor's Draft of CSSOM. Please send comments to
9494
<a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a>
9595
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
9696
with <samp>[cssom]</samp> at the start of the subject line.
@@ -1738,8 +1738,15 @@ <h3 id="css-rules"><span class="secno">6.4 </span>CSS Rules</h3>
17381738
<p>In addition to the above state, each <a href="#css-rule">CSS rule</a> may be associated
17391739
with other state in accordance with its <a href="#concept-css-rule-type" title="concept-css-rule-type">type</a>.</p>
17401740

1741-
<p>To <dfn id="parse-a-css-rule">parse a CSS rule</dfn> from a string <var>string</var>, invoke <a class="external" data-anolis-spec="csssyntax" href="http://dev.w3.org/csswg/css-syntax/#parse-a-rule0">parse a rule</a> with <var>string</var> and return
1742-
the value returned.</p>
1741+
<p>To <dfn id="parse-a-css-rule">parse a CSS rule</dfn> from a string <var>string</var>, run the following steps:
1742+
1743+
<ol>
1744+
<li><p>Let <var>rule</var> be the return value of invoking <a class="external" data-anolis-spec="csssyntax" href="http://dev.w3.org/csswg/css-syntax/#parse-a-rule0">parse a rule</a> with <var>string</var>.
1745+
<li><p>If <var>rule</var> is a syntax error, return <var>rule</var>.
1746+
<li><p>Let <var>parsed rule</var> be the result of parsing <var>rule</var> according to the appropriate CSS specifications, dropping parts that are said to be
1747+
ignored. If the whole style rule is dropped, return a syntax error.
1748+
<li><p>Return <var>parsed rule</var>.
1749+
</ol>
17431750

17441751
<p>To <dfn id="serialize-a-css-rule">serialize a CSS rule</dfn>, perform one of the following in accordance with the <a href="#css-rule">CSS rule</a>'s
17451752
<a href="#concept-css-rule-type" title="concept-css-rule-type">type</a>:</p>
@@ -1813,8 +1820,6 @@ <h3 id="css-rules"><span class="secno">6.4 </span>CSS Rules</h3>
18131820
on argument <var>rule</var>.
18141821
<li><p>If <var>new rule</var> is a syntax error, <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a>
18151822
a <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#syntaxerror">SyntaxError</a></code> exception.</li>
1816-
<li><p>Parse <var>new rule</var> according to the appropriate CSS specifications, dropping parts that are said to be ignored. If the whole style rule is
1817-
dropped, <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> a <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#syntaxerror">SyntaxError</a></code> exception.
18181823
<li><p>If <var>new rule</var> is an <code title="">@charset</code> at-rule, <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> a
18191824
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#syntaxerror">SyntaxError</a></code> exception.
18201825
<li><p>Set <var>length</var> to the number of items in <var>list</var>.</li>
@@ -2210,8 +2215,19 @@ <h3 id="css-declaration-blocks"><span class="secno">6.6 </span>CSS Declaration B
22102215
null otherwise.
22112216
</dl>
22122217

2213-
<p>To <dfn id="parse-a-css-declaration-block">parse a CSS declaration block</dfn> from a string <var>string</var>, invoke <a class="external" data-anolis-spec="csssyntax" href="http://dev.w3.org/csswg/css-syntax/#parse-a-list-of-declarations0">parse a list of declarations</a> with
2214-
<var>string</var> and return the value returned.</p>
2218+
<p>To <dfn id="parse-a-css-declaration-block">parse a CSS declaration block</dfn> from a string <var>string</var>, follow these steps:
2219+
2220+
<ol>
2221+
<li><p>Let <var>declarations</var> be the return value of invoking <a class="external" data-anolis-spec="csssyntax" href="http://dev.w3.org/csswg/css-syntax/#parse-a-list-of-declarations0">parse a list of declarations</a> with <var>string</var>.
2222+
<li><p>Let <var>parsed declarations</var> be a new empty list.
2223+
<li><p>For each item <var>declaration</var> in <var>declarations</var>, follow these substeps:
2224+
<ol>
2225+
<li><p>Let <var>parsed declaration</var> be the result of parsing <var>declaration</var> according to the appropriate CSS specifications, dropping parts that
2226+
are said to be ignored. If the whole declaration is dropped, let <var>parsed declaration</var> be null.
2227+
<li><p>If <var>parsed declaration</var> is not null, append it to <var>parsed declarations</var>.
2228+
</ol>
2229+
<li><p>Return <var>parsed declarations</var>.
2230+
</ol>
22152231

22162232
<p>To <dfn id="serialize-a-css-declaration">serialize a CSS declaration</dfn> with property name <var>property</var>, value <var>value</var> and optionally an <i>important</i> flag set, follow
22172233
these steps:

cssom/Overview.src.html

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,8 +1658,15 @@ <h3>CSS Rules</h3>
16581658
<p>In addition to the above state, each <span>CSS rule</span> may be associated
16591659
with other state in accordance with its <span title=concept-css-rule-type>type</span>.</p>
16601660

1661-
<p>To <dfn>parse a CSS rule</dfn> from a string <var>string</var>, invoke <span data-anolis-spec=csssyntax>parse a rule</span> with <var>string</var> and return
1662-
the value returned.</p>
1661+
<p>To <dfn>parse a CSS rule</dfn> from a string <var>string</var>, run the following steps:
1662+
1663+
<ol>
1664+
<li><p>Let <var>rule</var> be the return value of invoking <span data-anolis-spec=csssyntax>parse a rule</span> with <var>string</var>.
1665+
<li><p>If <var>rule</var> is a syntax error, return <var>rule</var>.
1666+
<li><p>Let <var>parsed rule</var> be the result of parsing <var>rule</var> according to the appropriate CSS specifications, dropping parts that are said to be
1667+
ignored. If the whole style rule is dropped, return a syntax error.
1668+
<li><p>Return <var>parsed rule</var>.
1669+
</ol>
16631670

16641671
<p>To <dfn>serialize a CSS rule</dfn>, perform one of the following in accordance with the <span>CSS rule</span>'s
16651672
<span title="concept-css-rule-type">type</span>:</p>
@@ -1733,8 +1740,6 @@ <h3>CSS Rules</h3>
17331740
on argument <var>rule</var>.
17341741
<li><p>If <var>new rule</var> is a syntax error, <span data-anolis-spec='dom' title='concept-throw'>throw</span>
17351742
a <code data-anolis-spec='dom'>SyntaxError</code> exception.</p></li>
1736-
<li><p>Parse <var>new rule</var> according to the appropriate CSS specifications, dropping parts that are said to be ignored. If the whole style rule is
1737-
dropped, <span data-anolis-spec='dom' title='concept-throw'>throw</span> a <code data-anolis-spec='dom'>SyntaxError</code> exception.
17381743
<li><p>If <var>new rule</var> is an <code title>@charset</code> at-rule, <span data-anolis-spec='dom' title='concept-throw'>throw</span> a
17391744
<code data-anolis-spec='dom'>SyntaxError</code> exception.
17401745
<li><p>Set <var>length</var> to the number of items in <var>list</var>.</p></li>
@@ -2130,8 +2135,19 @@ <h3>CSS Declaration Blocks</h3>
21302135
null otherwise.
21312136
</dl>
21322137

2133-
<p>To <dfn>parse a CSS declaration block</dfn> from a string <var>string</var>, invoke <span data-anolis-spec=csssyntax>parse a list of declarations</span> with
2134-
<var>string</var> and return the value returned.</p>
2138+
<p>To <dfn>parse a CSS declaration block</dfn> from a string <var>string</var>, follow these steps:
2139+
2140+
<ol>
2141+
<li><p>Let <var>declarations</var> be the return value of invoking <span data-anolis-spec=csssyntax>parse a list of declarations</span> with <var>string</var>.
2142+
<li><p>Let <var>parsed declarations</var> be a new empty list.
2143+
<li><p>For each item <var>declaration</var> in <var>declarations</var>, follow these substeps:
2144+
<ol>
2145+
<li><p>Let <var>parsed declaration</var> be the result of parsing <var>declaration</var> according to the appropriate CSS specifications, dropping parts that
2146+
are said to be ignored. If the whole declaration is dropped, let <var>parsed declaration</var> be null.
2147+
<li><p>If <var>parsed declaration</var> is not null, append it to <var>parsed declarations</var>.
2148+
</ol>
2149+
<li><p>Return <var>parsed declarations</var>.
2150+
</ol>
21352151

21362152
<p>To <dfn>serialize a CSS declaration</dfn> with property name <var>property</var>, value <var>value</var> and optionally an <i>important</i> flag set, follow
21372153
these steps:

0 commit comments

Comments
 (0)