Skip to content

Commit 2821e3f

Browse files
author
Simon Pieters
committed
[cssom] Use an interface instead of sequence for CSSRuleList and StyleSheetList, since there may be content that rely on item() working. Align with DOM's NodeList. https://www.w3.org/Bugs/Public/show_bug.cgi?id=22133
1 parent c5f1da6 commit 2821e3f

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

cssom/Overview.src.html

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,11 +1112,21 @@ <h4>The HTTP <code title>Default-Style</code> Header</h4>
11121112
value of the header.</p>
11131113

11141114

1115-
<h4>The <code title>StyleSheetList</code> Sequence</h4>
1115+
<h4>The <code title>StyleSheetList</code> Interface</h4>
11161116

1117-
<pre class=idl>typedef sequence&lt;<span>StyleSheet</span>> <span>StyleSheetList</span>;</pre>
1118-
<p>The <dfn>StyleSheetList</dfn> sequence represents an ordered collection of <span title='style sheets'>style sheets</span>.</p>
1117+
<p>The <code>StyleSheetList</code> interface represents an ordered collection of <span>style sheets</span>.</p>
11191118

1119+
<pre class=idl>[ArrayClass]
1120+
interface <dfn>StyleSheetList</dfn> {
1121+
getter <span>StyleSheet</span>? <span title=dom-StyleSheetList-item>item</span>(unsigned long index);
1122+
readonly attribute unsigned long <span title=dom-StyleSheetList-length>length</span>;
1123+
};</pre>
1124+
1125+
<p>The object's <span data-anolis-spec=webidl>supported property indices</span> are the numbers in the range zero to one less than the number of <span>style sheets</span> represented by the collection. If there are no such <span>style sheets</span>, then there are no <span data-anolis-spec=webidl>supported property indices</span>.
1126+
1127+
<p>The <dfn title=dom-StyleSheetList-item><code>item(<var>index</var>)</code></dfn> method must return the <var>index</var>th <span>style sheet</span> in the collection. If there is no <var>index</var>th object in the collection, then the method must return <code>null</code>.
1128+
1129+
<p>The <dfn title=dom-StyleSheetList-length><code>length</code></dfn> attribute must return the number of <span>style sheets</span> represented by the collection.
11201130

11211131
<h4>Extensions to the <code title>Document</code> Interface</h4>
11221132

@@ -1177,7 +1187,7 @@ <h4>Extensions to the <code title>Document</code> Interface</h4>
11771187
void <span title=dom-Document-enableStyleSheetsForSet>enableStyleSheetsForSet</span>(DOMString? name);<!-- new -->
11781188
};</pre>
11791189

1180-
<p>The <dfn title=dom-Document-styleSheets><code>styleSheets</code></dfn> attribute must return a <code>StyleSheetList</code> sequence representing
1190+
<p>The <dfn title=dom-Document-styleSheets><code>styleSheets</code></dfn> attribute must return a <code>StyleSheetList</code> collection representing
11811191
the <span>document style sheets</span>.</p>
11821192
<p class='note'>Because of historical IDL limitations the <code title=dom-Document-styleSheets>styleSheets</code> attribute
11831193
used to be on a separate interface, <code>DocumentStyle</code>.</p>
@@ -1673,12 +1683,21 @@ <h3>CSS Rules</h3>
16731683
</dl>
16741684

16751685

1676-
<h4>The <code title>CSSRuleList</code> Sequence</h4>
1686+
<h4>The <code title>CSSRuleList</code> Interface</h4>
1687+
1688+
<p>The <code>CSSRuleList</code> interface represents an ordered collection of CSS style rules.</p>
1689+
1690+
<pre class=idl>[ArrayClass]
1691+
interface <dfn>CSSRuleList</dfn> {
1692+
getter <span>CSSRule</span>? <span title=dom-CSSRuleList-item>item</span>(unsigned long index);
1693+
readonly attribute unsigned long <span title=dom-CSSRuleList-length>length</span>;
1694+
};</pre>
16771695

1678-
<pre class=idl>typedef sequence&lt;<span>CSSRule</span>> <span>CSSRuleList</span>;</pre>
1696+
<p>The object's <span data-anolis-spec=webidl>supported property indices</span> are the numbers in the range zero to one less than the number of <code>CSSRule</code> objects represented by the collection. If there are no such <code>CSSRule</code> objects, then there are no <span data-anolis-spec=webidl>supported property indices</span>.
16791697

1680-
<p>The <dfn><code>CSSRuleList</code></dfn> sequence represents an ordered collection of CSS style rules.</p>
1698+
<p>The <dfn title=dom-StyleSheetList-item><code>item(<var>index</var>)</code></dfn> method must return the <var>index</var>th <code>CSSRule</code> object in the collection. If there is no <var>index</var>th object in the collection, then the method must return <code>null</code>.
16811699

1700+
<p>The <dfn title=dom-StyleSheetList-length><code>length</code></dfn> attribute must return the number of <code>CSSRule</code> objects represented by the collection.
16821701

16831702
<h4>The <code title>CSSRule</code> Interface</h4>
16841703

0 commit comments

Comments
 (0)