10000 [cssom] Define legacy CSSStyleSheet methods as implemented in Blink. · w3c/csswg-drafts@ffe6f2b · GitHub
[go: up one dir, main page]

Skip to content

Commit ffe6f2b

Browse files
committed
[cssom] Define legacy CSSStyleSheet methods as implemented in Blink.
1 parent bfe77ef commit ffe6f2b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

cssom-1/Overview.bs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,10 @@ interface CSSStyleSheet : StyleSheet {
911911
[SameObject] readonly attribute CSSRuleList cssRules;
912912
unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0);
913913
void deleteRule(unsigned long index);
914+
915+
[SameObject] readonly attribute CSSRuleList rules;
916+
long addRule(optional DOMString selector = "undefined", optional DOMString style = "undefined", optional unsigned long index);
917+
void removeRule(optional unsigned long index = 0);
914918
};
915919
</pre>
916920

@@ -949,6 +953,25 @@ The <dfn method for=CSSStyleSheet>deleteRule(<var>index</var>)</dfn> method must
949953
<li><a>Remove a CSS rule</a> in the <a for=CSSStyleSheet>CSS rules</a> at <var>index</var>.
950954
</ol>
951955

956+
Legacy CSSStyleSheet members
957+
----------------------------
958+
959+
The <dfn attribute for=CSSStyleSheet>rules</dfn> attribute must follow the same steps as {{CSSStyleSheet/cssRules}}, and return the same object {{CSSStyleSheet/cssRules}} would return.
960+
961+
The <dfn attribute for=CSSStyleSheet>removeRule(<var>index</var>)</dfn> method must run the same steps as {{CSSStyleSheet/deleteRule()}}.
962+
963+
The <dfn method for=CSSStyleSheet>addRule(<var>selector</var>, <var>block</var>, <var>optionalIndex</var>)</dfn> method must run the following steps:
964+
965+
<ol>
966+
<li>Let <var>rule</var> be an empty string.
967+
<li>Append <var>selector</var> to <var>rule</var>.
968+
<li>Append <code>" { "</code> to <var>rule</var>.
969+
<li>If <var>block</var> is not empty, append <var>block</var>, followed by an space, to <var>rule</var>.
970+
<li>Append <code>"}"</code> to <var>rule</var>
971+
<li>Let <var>index</var> be <var>optionalIndex</var> if provided, or the number of <a for=CSSStyleSheet>CSS rules</a> in the stylesheet otherwise.
972+
<li>Call {{CSSStyleSheet/insertRule()}}, with <var>rule</var> and <var>index</var> as arguments.
973+
</ol>
974+
952975
CSS Style Sheet Collections {#css-style-sheet-collections}
953976
----------------------------------------------------------
954977

0 commit comments

Comments
 (0)
0