Skip to content

Commit c3c26eb

Browse files
author
Simon Pieters
committed
[cssom] Define CSSRule.type better
1 parent 2330f19 commit c3c26eb

2 files changed

Lines changed: 45 additions & 71 deletions

File tree

cssom/Overview.html

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,42 +1796,29 @@ <h4 id="the-cssrule-interface"><span class="secno">6.4.2 </span>The <code title=
17961796
readonly attribute <a href="#cssstylesheet">CSSStyleSheet</a>? <a href="#dom-cssrule-parentstylesheet" title="dom-CSSRule-parentStyleSheet">parentStyleSheet</a>;
17971797
};</pre>
17981798

1799-
<!-- XXX saying "must implement" is wrong. -->
1799+
<p>The <dfn id="dom-cssrule-type" title="dom-CSSRule-type"><code>type</code></dfn> attribute must return the CSS rule type, as follows:
18001800

1801-
<p>When the value of the <code>type</code> attribute is <dfn id="dom-cssrule-style_rule" title="dom-CSSRule-STYLE_RULE"><code>STYLE_RULE</code></dfn>, then the object that implements
1802-
this interface must implement the <code><a href="#cssstylerule">CSSStyleRule</a></code> interface.</p>
1803-
1804-
<p>When the value of the <code>type</code> attribute is <dfn id="dom-cssrule-charset_rule" title="dom-CSSRule-CHARSET_RULE"><code>CHARSET_RULE</code></dfn>, then the object that implements
1805-
this interface must implement the <code><a href="#csscharsetrule">CSSCharsetRule</a></code> interface.</p>
1806-
1807-
<p>When the value of the <code>type</code> attribute is <dfn id="dom-cssrule-import_rule" title="dom-CSSRule-IMPORT_RULE"><code>IMPORT_RULE</code></dfn>, then the object that implements
1808-
this interface must implement the <code><a href="#cssimportrule">CSSImportRule</a></code> interface.</p>
1809-
1810-
<p>When the value of the <code>type</code> attribute is <dfn id="dom-cssrule-media_rule" title="dom-CSSRule-MEDIA_RULE"><code>MEDIA_RULE</code></dfn>, then the object that implements
1811-
this interface must implement the <code><a href="#cssmediarule">CSSMediaRule</a></code> interface.</p>
1812-
1813-
<p>When the value of the <code>type</code> attribute is <dfn id="dom-cssrule-font_face_rule" title="dom-CSSRule-FONT_FACE_RULE"><code>FONT_FACE_RULE</code></dfn>, then the object that implements
1814-
this interface must implement the <code><a href="#cssfontfacerule">CSSFontFaceRule</a></code> interface.</p>
1815-
1816-
<p>When the value of the <code>type</code> attribute is <dfn id="dom-cssrule-page_rule" title="dom-CSSRule-PAGE_RULE"><code>PAGE_RULE</code></dfn>, then the object that implements
1817-
this interface must implement the <code><a href="#csspagerule">CSSPageRule</a></code> interface.</p>
1818-
1819-
<p>When the value of the <code>type</code> attribute is <dfn id="dom-cssrule-namespace_rule" title="dom-CSSRule-NAMESPACE_RULE"><code>NAMESPACE_RULE</code></dfn>, then the object that implements
1820-
this interface must implement the <code><a href="#cssnamespacerule">CSSNamespaceRule</a></code> interface.</p>
1801+
<dl class="switch">
1802+
<dt>If the object is a <code><a href="#cssstylerule">CSSStyleRule</a></code>
1803+
<dd><p>Return <dfn id="dom-cssrule-style_rule" title="dom-CSSRule-STYLE_RULE"><code>STYLE_RULE</code></dfn> (numeric value 1).
1804+
<dt>If the object is a <code><a href="#csscharsetrule">CSSCharsetRule</a></code>
1805+
<dd><p>Return <dfn id="dom-cssrule-charset_rule" title="dom-CSSRule-CHARSET_RULE"><code>CHARSET_RULE</code></dfn> (numberic value 2).
1806+
<dt>If the object is a <code><a href="#cssimportrule">CSSImportRule</a></code>
1807+
<dd><p>Return <dfn id="dom-cssrule-import_rule" title="dom-CSSRule-IMPORT_RULE"><code>IMPORT_RULE</code></dfn> (numberic value 3).
1808+
<dt>If the object is a <code><a href="#cssmediarule">CSSMediaRule</a></code>
1809+
<dd><p>Return <dfn id="dom-cssrule-media_rule" title="dom-CSSRule-MEDIA_RULE"><code>MEDIA_RULE</code></dfn> (numeric value 4).
1810+
<dt>If the object is a <code><a href="#cssfontfacerule">CSSFontFaceRule</a></code>
1811+
<dd><p>Return <dfn id="dom-cssrule-font_face_rule" title="dom-CSSRule-FONT_FACE_RULE"><code>FONT_FACE_RULE</code></dfn> (numeric value 5).
1812+
<dt>If the object is a <code><a href="#csspagerule">CSSPageRule</a></code>
1813+
<dd><p>Return <dfn id="dom-cssrule-page_rule" title="dom-CSSRule-PAGE_RULE"><code>PAGE_RULE</code></dfn> (numeric value 6).
1814+
<dt>If the object is a <code><a href="#cssnamespacerule">CSSNamespaceRule</a></code>
1815+
<dd><p>Return <dfn id="dom-cssrule-namespace_rule" title="dom-CSSRule-NAMESPACE_RULE"><code>NAMESPACE_RULE</code></dfn> (numeric value 10).
1816+
<dt>Otherwise
1817+
<dd><p>Return a value defined on the <a href="http://wiki.csswg.org/spec/cssom-constants">CSSOM Constants</a> wiki page.
1818+
</dl>
18211819

1822-
<p>The <dfn id="dom-cssrule-type" title="dom-CSSRule-type"><code>type</code></dfn> attribute must return one of the following values:
1823-
<code title="dom-CSSRule-STYLE_RULE"><a href="#dom-cssrule-style_rule">STYLE_RULE</a></code>,
1824-
<code title="dom-CSSRule-IMPORT_RULE"><a href="#dom-cssrule-import_rule">IMPORT_RULE</a></code>,
1825-
<code title="dom-CSSRule-MEDIA_RULE"><a href="#dom-cssrule-media_rule">MEDIA_RULE</a></code>,
1826-
<code title="dom-CSSRule-FONT_FACE_RULE"><a href="#dom-cssrule-font_face_rule">FONT_FACE_RULE</a></code>,
1827-
<code title="dom-CSSRule-PAGE_RULE"><a href="#dom-cssrule-page_rule">PAGE_RULE</a></code>,
1828-
<code title="dom-CSSRule-NAMESPACE_RULE"><a href="#dom-cssrule-namespace_rule">NAMESPACE_RULE</a></code>,
1829-
or a registered extension value.
1830-
</p>
1831-
<p>The value 0, formerly known as <code>UNKNOWN_RULE</code>, is made
1832-
obsolete by this specification. This value will not be re-allocated in the future and shall remain reserved.</p>
1833-
<p class="note">Constants for new and proprietary rule types are coordinated
1834-
on the <a href="http://wiki.csswg.org/spec/cssom-constants">CSSOM Constants</a> wiki page.</p>
1820+
<p class="note">The value 0, formerly known as <code title="">UNKNOWN_RULE</code>, is made
1821+
obsolete by this specification. This value will not be re-allocated in the future and will remain reserved.</p>
18351822

18361823
<p>The <dfn id="dom-cssrule-csstext" title="dom-CSSRule-cssText"><code>cssText</code></dfn> attribute must return a <a href="#serialize-a-css-rule" title="serialize a CSS rule">serialization</a> of the
18371824
<a href="#css-rule">CSS rule</a>.</p>
@@ -2106,7 +2093,7 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
21062093

21072094
<p>The <dfn id="dom-cssstyledeclaration-length" title="dom-CSSStyleDeclaration-length"><code>length</code></dfn> attribute must return the number of declarations in the <a href="#css-declaration-block-declarations">CSS declaration block declarations</a>.</p>
21082095

2109-
<p>The <dfn id="dom-cssstyledeclaration-item" title="dom-CSSStyleDeclaration-item"><code>item(<var>index</var>)</code></dfn> method must return the name of the property at position <var>index</var>.</p>"
2096+
<p>The <dfn id="dom-cssstyledeclaration-item" title="dom-CSSStyleDeclaration-item"><code>item(<var>index</var>)</code></dfn> method must return the name of the property at position <var>index</var>.</p>
21102097

21112098
<p>The <dfn id="dom-cssstyledeclaration-getpropertyvalue" title="dom-CSSStyleDeclaration-getPropertyValue"><code>getPropertyValue(<var>property</var>)</code></dfn> method must run these steps:</p>
21122099
<ol>

cssom/Overview.src.html

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,42 +1726,29 @@ <h4>The <code title>CSSRule</code> Interface</h4>
17261726
readonly attribute <span>CSSStyleSheet</span>? <span title=dom-CSSRule-parentStyleSheet>parentStyleSheet</span>;
17271727
};</pre>
17281728

1729-
<!-- XXX saying "must implement" is wrong. -->
1730-
1731-
<p>When the value of the <code>type</code> attribute is <dfn title=dom-CSSRule-STYLE_RULE><code>STYLE_RULE</code></dfn>, then the object that implements
1732-
this interface must implement the <code>CSSStyleRule</code> interface.</p>
1733-
1734-
<p>When the value of the <code>type</code> attribute is <dfn title=dom-CSSRule-CHARSET_RULE><code>CHARSET_RULE</code></dfn>, then the object that implements
1735-
this interface must implement the <code>CSSCharsetRule</code> interface.</p>
1736-
1737-
<p>When the value of the <code>type</code> attribute is <dfn title=dom-CSSRule-IMPORT_RULE><code>IMPORT_RULE</code></dfn>, then the object that implements
1738-
this interface must implement the <code>CSSImportRule</code> interface.</p>
1739-
1740-
<p>When the value of the <code>type</code> attribute is <dfn title=dom-CSSRule-MEDIA_RULE><code>MEDIA_RULE</code></dfn>, then the object that implements
1741-
this interface must implement the <code>CSSMediaRule</code> interface.</p>
1742-
1743-
<p>When the value of the <code>type</code> attribute is <dfn title=dom-CSSRule-FONT_FACE_RULE><code>FONT_FACE_RULE</code></dfn>, then the object that implements
1744-
this interface must implement the <code>CSSFontFaceRule</code> interface.</p>
1745-
1746-
<p>When the value of the <code>type</code> attribute is <dfn title=dom-CSSRule-PAGE_RULE><code>PAGE_RULE</code></dfn>, then the object that implements
1747-
this interface must implement the <code>CSSPageRule</code> interface.</p>
1748-
1749-
<p>When the value of the <code>type</code> attribute is <dfn title=dom-CSSRule-NAMESPACE_RULE><code>NAMESPACE_RULE</code></dfn>, then the object that implements
1750-
this interface must implement the <code>CSSNamespaceRule</code> interface.</p>
1729+
<p>The <dfn title=dom-CSSRule-type><code>type</code></dfn> attribute must return the CSS rule type, as follows:
1730+
1731+
<dl class=switch>
1732+
<dt>If the object is a <code>CSSStyleRule</code>
1733+
<dd><p>Return <dfn title=dom-CSSRule-STYLE_RULE><code>STYLE_RULE</code></dfn> (numeric value 1).
1734+
<dt>If the object is a <code>CSSCharsetRule</code>
1735+
<dd><p>Return <dfn title=dom-CSSRule-CHARSET_RULE><code>CHARSET_RULE</code></dfn> (numberic value 2).
1736+
<dt>If the object is a <code>CSSImportRule</code>
1737+
<dd><p>Return <dfn title=dom-CSSRule-IMPORT_RULE><code>IMPORT_RULE</code></dfn> (numberic value 3).
1738+
<dt>If the object is a <code>CSSMediaRule</code>
1739+
<dd><p>Return <dfn title=dom-CSSRule-MEDIA_RULE><code>MEDIA_RULE</code></dfn> (numeric value 4).
1740+
<dt>If the object is a <code>CSSFontFaceRule</code>
1741+
<dd><p>Return <dfn title=dom-CSSRule-FONT_FACE_RULE><code>FONT_FACE_RULE</code></dfn> (numeric value 5).
1742+
<dt>If the object is a <code>CSSPageRule</code>
1743+
<dd><p>Return <dfn title=dom-CSSRule-PAGE_RULE><code>PAGE_RULE</code></dfn> (numeric value 6).
1744+
<dt>If the object is a <code>CSSNamespaceRule</code>
1745+
<dd><p>Return <dfn title=dom-CSSRule-NAMESPACE_RULE><code>NAMESPACE_RULE</code></dfn> (numeric value 10).
1746+
<dt>Otherwise
1747+
<dd><p>Return a value defined on the <a href='http://wiki.csswg.org/spec/cssom-constants'>CSSOM Constants</a> wiki page.
1748+
</dl>
17511749

1752-
<p>The <dfn title=dom-CSSRule-type><code>type</code></dfn> attribute must return one of the following values:
1753-
<code title=dom-CSSRule-STYLE_RULE>STYLE_RULE</code>,
1754-
<code title=dom-CSSRule-IMPORT_RULE>IMPORT_RULE</code>,
1755-
<code title=dom-CSSRule-MEDIA_RULE>MEDIA_RULE</code>,
1756-
<code title=dom-CSSRule-FONT_FACE_RULE>FONT_FACE_RULE</code>,
1757-
<code title=dom-CSSRule-PAGE_RULE>PAGE_RULE</code>,
1758-
<code title=dom-CSSRule-NAMESPACE_RULE>NAMESPACE_RULE</code>,
1759-
or a registered extension value.
1760-
</p>
1761-
<p>The value 0, formerly known as <code>UNKNOWN_RULE</code>, is made
1762-
obsolete by this specification. This value will not be re-allocated in the future and shall remain reserved.</p>
1763-
<p class='note'>Constants for new and proprietary rule types are coordinated
1764-
on the <a href='http://wiki.csswg.org/spec/cssom-constants'>CSSOM Constants</a> wiki page.</p>
1750+
<p class=note>The value 0, formerly known as <code title>UNKNOWN_RULE</code>, is made
1751+
obsolete by this specification. This value will not be re-allocated in the future and will remain reserved.</p>
17651752

17661753
<p>The <dfn title=dom-CSSRule-cssText><code>cssText</code></dfn> attribute must return a <span title='serialize a CSS rule'>serialization</span> of the
17671754
<span>CSS rule</span>.</p>
@@ -2036,7 +2023,7 @@ <h4>The <code title>CSSStyleDeclaration</code> Interface</h4>
20362023

20372024
<p>The <dfn title=dom-CSSStyleDeclaration-length><code>length</code></dfn> attribute must return the number of declarations in the <span>CSS declaration block declarations</span>.</p>
20382025

2039-
<p>The <dfn title=dom-CSSStyleDeclaration-item><code>item(<var>index</var>)</code></dfn> method must return the name of the property at position <var>index</var>.</p>"
2026+
<p>The <dfn title=dom-CSSStyleDeclaration-item><code>item(<var>index</var>)</code></dfn> method must return the name of the property at position <var>index</var>.</p>
20402027

20412028
<p>The <dfn title=dom-CSSStyleDeclaration-getPropertyValue><code>getPropertyValue(<var>property</var>)</code></dfn> method must run these steps:</p>
20422029
<ol>

0 commit comments

Comments
 (0)