Skip to content

Commit d51fd97

Browse files
author
Simon Pieters
committed
[cssom] Hook into css-syntax for 'parse a CSS rule'
1 parent 0ff988f commit d51fd97

2 files changed

Lines changed: 27 additions & 18 deletions

File tree

cssom/Overview.html

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<h1>CSS Object Model (CSSOM)</h1>
3939

4040

41-
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 10 June 2013</h2>
41+
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 11 June 2013</h2>
4242

4343
<dl>
4444

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

115-
<p class="dontpublish">This is the 10 June 2013 Editor's Draft of CSSOM. Please send comments to
115+
<p class="dontpublish">This is the 11 June 2013 Editor's Draft of CSSOM. Please send comments to
116116
<a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a>
117117
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
118118
with <samp>[cssom]</samp> at the start of the subject line.
@@ -271,13 +271,15 @@ <h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
271271
<p>This specification employs certain terminology from the following documents:
272272
<cite>DOM</cite>,
273273
<cite>HTML</cite>,
274+
<cite>CSS Syntax</cite>,
274275
<cite>URL</cite>,
275276
<cite>Fetch</cite>,
276277
<cite>Associating Style Sheets with XML documents</cite>
277278
and
278279
<cite>XML</cite>.
279280
<a href="#refsDOM">[DOM]</a>
280281
<a href="#refsHTML">[HTML]</a>
282+
<a href="#refsCSSSYNTAX">[CSSSYNTAX]</a>
281283
<a href="#refsURL">[URL]</a>
282284
<a href="#refsFETCH">[FETCH]</a>
283285
<a href="#refsXMLSS">[XMLSS]</a>
@@ -1750,7 +1752,8 @@ <h3 id="css-rules"><span class="secno">6.4 </span>CSS Rules</h3>
17501752
<p>In addition to the above state, each <a href="#css-rule">CSS rule</a> may be associated
17511753
with other state in accordance with its <a href="#concept-css-rule-type" title="concept-css-rule-type">type</a>.</p>
17521754

1753-
<p>To <dfn id="parse-a-css-rule">parse a CSS rule</dfn> ...</p>
1755+
<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
1756+
the value returned.</p>
17541757

17551758
<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
17561759
<a href="#concept-css-rule-type" title="concept-css-rule-type">type</a>:</p>
@@ -1821,8 +1824,9 @@ <h3 id="css-rules"><span class="secno">6.4 </span>CSS Rules</h3>
18211824
<p>To <dfn id="insert-a-css-rule">insert a CSS rule</dfn> <var>rule</var> in a CSS rule list <var>list</var> at index <var>index</var>, follow these steps:</p>
18221825
<ol>
18231826
<li><p>Set <var>new rule</var> to the results of performing <a href="#parse-a-css-rule">parse a CSS rule</a>
1824-
on argument <var>rule</var>, <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throwing</a>
1825-
a <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#syntaxerror">SyntaxError</a></code> exception if a parse error occurs.</li>
1827+
on argument <var>rule</var>.
1828+
<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>
1829+
a <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#syntaxerror">SyntaxError</a></code> exception.</li>
18261830
<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
18271831
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#syntaxerror">SyntaxError</a></code> exception.
18281832
<li><p>Set <var>length</var> to the number of items in <var>list</var>.</li>
@@ -1930,14 +1934,13 @@ <h4 id="the-cssrule-interface"><span class="secno">6.4.2 </span>The <code title=
19301934
<a href="#css-rule">CSS rule</a>.</p>
19311935
<p>On setting the <code title="dom-CSSRule-cssText"><a href="#dom-cssrule-csstext">cssText</a></code> attribute these steps must be run:</p>
19321936
<ol>
1933-
<li><p><a href="#parse-a-css-rule" title="Parse a CSS rule">Parse</a> the value.</li>
1934-
<li><p>If parsing failed terminate this algorithm.</li>
1935-
<li><p>If the <code title="dom-CSSRule-type"><a href="#dom-cssrule-type">type</a></code> of the new
1936-
object does not match the <code title="dom-CSSRule-type"><a href="#dom-cssrule-type">type</a></code> of
1937+
<li><p>Let <var>new rule</var> be the returned value of <a href="#parse-a-css-rule" title="parse a CSS rule">parsing</a> the value.</li>
1938+
<li><p>If <var>new rule</var> is a syntax error, terminate this algorithm.</li>
1939+
<li><p>If the <a href="#concept-css-rule-type" title="concept-css-rule-type">type</a> of <var>new rule</var> does not match the <a href="#concept-css-rule-type" title="concept-css-rule-type">type</a> of
19371940
the current object
19381941
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a> an
19391942
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#invalidmodificationerror">InvalidModificationError</a></code> exception.</li>
1940-
<li><p>Replace the current object with the new object.</li>
1943+
<li><p>Replace the current object with <var>new rule</var>.</li>
19411944
</ol>
19421945

19431946
<p>The <dfn id="dom-cssrule-parentrule" title="dom-CSSRule-parentRule"><code>parentRule</code></dfn> attribute must return the nearest enclosing rule of the current rule or null if
@@ -2962,6 +2965,9 @@ <h2 class="no-num" id="references">References</h2>
29622965
<dt id="refsCSSPAGE">[CSSPAGE]
29632966
<dd><cite><a href="http://dev.w3.org/csswg/css-page/">CSS Paged Media Module</a></cite>, Melinda Grant, Håkon Wium Lie, Elika J. Etemad et al.. W3C.
29642967

2968+
<dt id="refsCSSSYNTAX">[CSSSYNTAX]
2969+
<dd><cite><a href="http://dev.w3.org/csswg/css-syntax/">CSS Syntax Module Level 3</a></cite>, Tab Atkins Jr. W3C.
2970+
29652971
<dt id="refsDOM">[DOM]
29662972
<dd><cite><a href="http://dom.spec.whatwg.org/">DOM</a></cite>, Anne van Kesteren, Aryeh Gregor and Ms2ger. WHATWG.
29672973

cssom/Overview.src.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,15 @@ <h2>Terminology</h2>
194194
<p>This specification employs certain terminology from the following documents:
195195
<cite>DOM</cite>,
196196
<cite>HTML</cite>,
197+
<cite>CSS Syntax</cite>,
197198
<cite>URL</cite>,
198199
<cite>Fetch</cite>,
199200
<cite>Associating Style Sheets with XML documents</cite>
200201
and
201202
<cite>XML</cite>.
202203
<span data-anolis-ref>DOM</span>
203204
<span data-anolis-ref>HTML</span>
205+
<span data-anolis-ref>CSSSYNTAX</span>
204206
<span data-anolis-ref>URL</span>
205207
<span data-anolis-ref>FETCH</span>
206208
<span data-anolis-ref>XMLSS</span>
@@ -1673,7 +1675,8 @@ <h3>CSS Rules</h3>
16731675
<p>In addition to the above state, each <span>CSS rule</span> may be associated
16741676
with other state in accordance with its <span title=concept-css-rule-type>type</span>.</p>
16751677

1676-
<p>To <dfn>parse a CSS rule</dfn> ...</p>
1678+
<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
1679+
the value returned.</p>
16771680

16781681
<p>To <dfn>serialize a CSS rule</dfn>, perform one of the following in accordance with the <span>CSS rule</span>'s
16791682
<span title="concept-css-rule-type">type</span>:</p>
@@ -1744,8 +1747,9 @@ <h3>CSS Rules</h3>
17441747
<p>To <dfn>insert a CSS rule</dfn> <var>rule</var> in a CSS rule list <var>list</var> at index <var>index</var>, follow these steps:</p>
17451748
<ol>
17461749
<li><p>Set <var>new rule</var> to the results of performing <span>parse a CSS rule</span>
1747-
on argument <var>rule</var>, <span data-anolis-spec='dom' title='concept-throw'>throwing</span>
1748-
a <code data-anolis-spec='dom'>SyntaxError</code> exception if a parse error occurs.</p></li>
1750+
on argument <var>rule</var>.
1751+
<li><p>If <var>new rule</var> is a syntax error, <span data-anolis-spec='dom' title='concept-throw'>throw</span>
1752+
a <code data-anolis-spec='dom'>SyntaxError</code> exception.</p></li>
17491753
<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
17501754
<code data-anolis-spec='dom'>SyntaxError</code> exception.
17511755
<li><p>Set <var>length</var> to the number of items in <var>list</var>.</p></li>
@@ -1853,14 +1857,13 @@ <h4>The <code title>CSSRule</code> Interface</h4>
18531857
<span>CSS rule</span>.</p>
18541858
<p>On setting the <code title=dom-CSSRule-cssText>cssText</code> attribute these steps must be run:</p>
18551859
<ol>
1856-
<li><p><span title='Parse a CSS rule'>Parse</span> the value.</p></li>
1857-
<li><p>If parsing failed terminate this algorithm.</p></li>
1858-
<li><p>If the <code title='dom-CSSRule-type'>type</code> of the new
1859-
object does not match the <code title='dom-CSSRule-type'>type</code> of
1860+
<li><p>Let <var>new rule</var> be the returned value of <span title='parse a CSS rule'>parsing</span> the value.</p></li>
1861+
<li><p>If <var>new rule</var> is a syntax error, terminate this algorithm.</p></li>
1862+
<li><p>If the <span title=concept-css-rule-type>type</span> of <var>new rule</var> does not match the <span title=concept-css-rule-type>type</span> of
18601863
the current object
18611864
<span data-anolis-spec=dom title=concept-throw>throw</span> an
18621865
<code data-anolis-spec=dom>InvalidModificationError</code> exception.</li>
1863-
<li><p>Replace the current object with the new object.</p></li>
1866+
<li><p>Replace the current object with <var>new rule</var>.</p></li>
18641867
</ol>
18651868

18661869
<p>The <dfn title=dom-CSSRule-parentRule><code>parentRule</code></dfn> attribute must return the nearest enclosing rule of the current rule or null if

0 commit comments

Comments
 (0)