001 
002 /*
003  *  JScripter Standard 1.0 - To Script In Java
004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
005  *  
006  *  This program is free software: you can redistribute it and/or modify
007  *  it under the terms of the GNU Affero General Public License as published by
008  *  the Free Software Foundation, either version 3 of the License, or
009  *  (at your option) any later version.
010  *  
011  *  This program is distributed in the hope that it will be useful,
012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014  *  GNU Affero General Public License for more details.
015  *  
016  *  You should have received a copy of the GNU Affero General Public License
017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
018  */
019 
020 package js.user;
021 
022 import js.*;
023 import js.core.*;
024 
025 /**
026  * <p>An <b>opaque</b> class representing JavaScript client-side objects of the global 
027  * {@link JsClient#CSSStyleSheet} class.</p>
028  * <p>This class represents a CSS stylesheet. It has properties and methods for disabling 
029  * the stylesheet, and for querying, inserting, and removing style rules. IE implements 
030  * a slightly different API than the DOM standard. In IE, use the {@link JsCSSStyleSheet#rules} 
031  * array instead of {@link JsCSSStyleSheet#cssRules}, and use {@link JsCSSStyleSheet#addRule(String, String, int)} 
032  * and {@link JsCSSStyleSheet#removeRule(int)} instead of the DOM standard {@link JsCSSStyleSheet#insertRule(String, long)} 
033  * and {@link JsCSSStyleSheet#deleteRule(long)}.</p>
034  * <p>The {@link JsCSSStyleSheet} objects that apply to a document are members of the 
035  * {@link JsDocument#styleSheets} array of the {@link JsDocument} object. The DOM 
036  * standard also requires that any <tt>&lt;style&gt;</tt> or <tt>&lt;link&gt;</tt> 
037  * element or {@link JsProcessingInstruction} node that defines or links to a stylesheet 
038  * should make the {@link JsCSSStyleSheet} object available through a <tt>sheet</tt> 
039  * property, but this is not widely implemented.</p>
040  *
041  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
042  *
043  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
044  * generated into the target codes. Re-compilers must exit with error on the operations of
045  * accessing that kind of class objects.
046  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored
047  * and <tt>instanceof</tt> to it always <tt>true</tt>.
048  */
049 public class JsCSSStyleSheet extends JsClient.CSSStyleSheet.Prototype
050 {
051     /**
052      * <p>An <b>internal</b> class containing membership data for its enclosing
053      * opaque class.</p>
054      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or
055      * class members.</p>
056      *
057      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
058      * 
059      * @javascript Re-compilers must report error on resolving an <b>internal</b> class.
060      */
061     protected static abstract class Members extends JsClient.CSSStyleSheet.Prototype.Members
062     {
063         /**
064          * <p>An <b>internal</b> static field defining a member ID of the field name and
065          * used internally to define a member of the same name.</p>
066          * @since 1.0
067          * @see JsCSSStyleSheet#cssRules
068          * @see JsCSSStyleSheet.Member#cssRules
069          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
070          */
071         public final static Mid cssRules         = id("cssRules"        );
072         /**
073          * <p>An <b>internal</b> static field defining a member ID of the field name and
074          * used internally to define a member of the same name.</p>
075          * @since 1.0
076          * @see JsCSSStyleSheet#disabled
077          * @see JsCSSStyleSheet.Member#disabled
078          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
079          */
080         public final static Mid disabled         = id("disabled"        );
081         /**
082          * <p>An <b>internal</b> static field defining a member ID of the field name and
083          * used internally to define a member of the same name.</p>
084          * @since 1.0
085          * @see JsCSSStyleSheet#href
086          * @see JsCSSStyleSheet.Member#href
087          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
088          */
089         public final static Mid href             = id("href"            );
090         /**
091          * <p>An <b>internal</b> static field defining a member ID of the field name and
092          * used internally to define a member of the same name.</p>
093          * @since 1.0
094          * @see JsCSSStyleSheet#parentStyleSheet
095          * @see JsCSSStyleSheet.Member#parentStyleSheet
096          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
097          */
098         public final static Mid parentStyleSheet = id("parentStyleSheet");
099         /**
100          * <p>An <b>internal</b> static field defining a member ID of the field name and
101          * used internally to define a member of the same name.</p>
102          * @since 1.0
103          * @see JsCSSStyleSheet#rules
104          * @see JsCSSStyleSheet.Member#rules
105          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
106          */
107         public final static Mid rules            = id("rules"           );
108         /**
109          * <p>An <b>internal</b> static field defining a member ID of the field name and
110          * used internally to define a member of the same name.</p>
111          * @since 1.0
112          * @see JsCSSStyleSheet#title
113          * @see JsCSSStyleSheet.Member#title
114          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
115          */
116         public final static Mid title            = id("title"           );
117         /**
118          * <p>An <b>internal</b> static field defining a member ID of the field name and
119          * used internally to define a member of the same name.</p>
120          * @since 1.0
121          * @see JsCSSStyleSheet#type
122          * @see JsCSSStyleSheet.Member#type
123          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
124          */
125         public final static Mid type             = id("type"            );
126     }
127     /**
128      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
129      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
130      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
131      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
132      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
133      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
134      * either circumstance, the field names must be exactly same as the member names, as 
135      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
136      * based on the field names.</p>
137      *
138      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
139      * 
140      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
141      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
142      * of class objects.
143      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
144      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
145      * <pre>q.m</pre>
146      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
147      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
148      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
149      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
150      * <pre>m</pre>
151      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
152      * error on the access to <b>opaque</b> fields declared by this class under any other 
153      * circumstances.
154      */
155     public static class Member extends JsClient.CSSStyleSheet.Prototype.Member
156     {
157         /**
158          * <p>Internally constructs a member based on a qualifying member.</p>
159          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
160          * or <b>internal</b> classes or class members.</p>
161          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
162          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
163          * declared in the declaring class of this constructor itself or its subclasses. 
164          * Under this circumstance, the field names must be exactly same as the member 
165          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
166          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
167          * to their names appending to the name resolved from the specified qualifying 
168          * member with a dot in between.</p>
169          * @param q A qualifying member
170          * @param mid The ID of the member to construct
171          * @since 1.0
172          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
173          */
174         public Member(JsObject.Member q, Mid mid) {
175             super(q, mid);
176         }
177         /**
178          * <p>Internally constructs a member without a qualifying member.</p>
179          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
180          * or <b>internal</b> classes or class members.</p>
181          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
182          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
183          * declared in <b>opaque</b> types other than the declaring class of this constructor 
184          * itself and its subclasses. Under this circumstance, the field names must be
185          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
186          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
187          * @param mid The ID of the member to construct
188          * @since 1.0
189          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
190          */
191         public Member(Mid mid) {
192             super(mid);
193         }
194         @Override
195         /**
196          * <p>Evaluates the property, represented by the current member instance, of the
197          * argument object.</p>
198          * @param o The argument object
199          * @return The value of the current member based on the object argument.
200          * @since 1.0
201          * @javascript Re-compilers must convert the instance invocation of this method into
202          * the JavaScript expression: 
203          * <pre>o.m</pre>
204          * where <tt>m</tt> is the identifier name resolved from the current member
205          * instance of the invocation.
206          */
207         public JsCSSStyleSheet with(ObjectLike o) {
208             return new JsCSSStyleSheet(super.with(o));
209         }
210 
211         /**
212          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
213          * name of this field, qualified by the current member instance of the field, and 
214          * to access the property of the name on an object.</p>
215          * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
216          * refers to a read-only array holding the {@link JsCSSRule} objects that compose 
217          * the stylesheet. In DOM-compliant implementations, this array includes objects 
218          * that represent all rules in a stylesheet, including at-rules such as \\@import 
219          * directives. Rules of these sorts implement a different interface than that are 
220          * described for CSSRule. The other types of rule objects are not well supported 
221          * across browsers.</p>
222          * <p>In Internet Explorer, use the {@link #rules} property instead.</p> 
223          * @since 1.0
224          * @see #rules
225          * @javascript Re-compilers must resolve the member of this instance field to the
226          * identifier of the field name appending to the identifier resolved from its 
227          * qualifying member with a dot in between.
228          */
229         public final JsArray.Member cssRules = new JsArray.Member(this, Members.cssRules);
230         /**
231          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
232          * name of this field, qualified by the current member instance of the field, and 
233          * to access the property of the name on an object.</p>
234          * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
235          * refers to a boolean value. If it is <tt>true</tt>, the stylesheet is disabled 
236          * and is not applied to the document. If <tt>false</tt>, the stylesheet is 
237          * enabled and is applied to the document.</p> 
238          * @since 1.0
239          * @javascript Re-compilers must resolve the member of this instance field to the
240          * identifier of the field name appending to the identifier resolved from its 
241          * qualifying member with a dot in between.
242          */
243         public final Value.Boolean.Member disabled = new Value.Boolean.Member(this, Members.disabled);
244         /**
245          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
246          * name of this field, qualified by the current member instance of the field, and 
247          * to access the property of the name on an object.</p>
248          * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
249          * is a read-only reference to the URL of a stylesheet that is linked to the 
250          * document or <tt>null</tt> for inline style-sheets.</p> 
251          * @since 1.0
252          * @javascript Re-compilers must resolve the member of this instance field to the
253          * identifier of the field name appending to the identifier resolved from its 
254          * qualifying member with a dot in between.
255          */
256         public final Value.String.Member href = new Value.String.Member(this, Members.href);
257         /**
258          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
259          * name of this field, qualified by the current member instance of the field, and 
260          * to access the property of the name on an object.</p>
261          * <p>The IE equivalent of {@link #cssRules} that is DOM-standard.</p> 
262          * @since 1.0
263          * @see #cssRules
264          * @javascript Re-compilers must resolve the member of this instance field to the
265          * identifier of the field name appending to the identifier resolved from its 
266          * qualifying member with a dot in between.
267          */
268         public final JsArray.Member rules = new JsArray.Member(this, Members.rules);
269         /**
270          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
271          * name of this field, qualified by the current member instance of the field, and 
272          * to access the property of the name on an object.</p>
273          * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
274          * is a read-only reference to the title of the stylesheet, if specified. A 
275          * title may be specified by the <tt>title</tt> attribute of a <tt>&lt;style&gt;</tt> 
276          * or <tt>&lt;link&gt;</tt> element that refers to this stylesheet.</p> 
277          * @since 1.0
278          * @javascript Re-compilers must resolve the member of this instance field to the
279          * identifier of the field name appending to the identifier resolved from its 
280          * qualifying member with a dot in between.
281          */
282         public final Value.String.Member title = new Value.String.Member(this, Members.title);
283         /**
284          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
285          * name of this field, qualified by the current member instance of the field, and 
286          * to access the property of the name on an object.</p>
287          * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
288          * is a read-only reference to the type of this stylesheet, as a MIME type. CSS 
289          * style-sheets have a type of "text/css".</p> 
290          * @since 1.0
291          * @javascript Re-compilers must resolve the member of this instance field to the
292          * identifier of the field name appending to the identifier resolved from its 
293          * qualifying member with a dot in between.
294          */
295         public final Value.String.Member type  = new Value.String.Member(this, Members.type );
296     }
297 
298     /**
299      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
300      * with the wrapping constructor.</p>
301      * @param var The argument of an <b>opaque</b> object.
302      * @since 1.0
303      * @javascript Re-compilers must ignore the construction operation of this constructor,
304      * that is, replacing it with its only argument.
305      */
306     public JsCSSStyleSheet(JsObject var) {
307         super(var);
308     }
309 
310     /**
311      * <p>An <b>opaque</b> static field defining a member that is named by the field name
312      * without a qualifying member and to access the property of the name on an object.</p>
313      * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
314      * refers to a read-only array holding the {@link JsCSSRule} objects that compose 
315      * the stylesheet. In DOM-compliant implementations, this array includes objects 
316      * that represent all rules in a stylesheet, including at-rules such as &#64;import 
317      * directives.</p>
318      * <p>In Internet Explorer, use the {@link #rules} property instead.</p> 
319      * @since 1.0
320      * @see #rules
321      * @javascript Re-compilers must resolve the member of this static field to the
322      * identifier of the field name.
323      */
324     public static final JsArray.Member cssRules = new JsArray.Member(Members.cssRules);
325     /**
326      * <p>An <b>opaque</b> static field defining a member that is named by the field name
327      * without a qualifying member and to access the property of the name on an object.</p>
328      * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
329      * refers to a boolean value. If it is <tt>true</tt>, the stylesheet is disabled 
330      * and is not applied to the document. If <tt>false</tt>, the stylesheet is 
331      * enabled and is applied to the document.</p> 
332      * @since 1.0
333      * @javascript Re-compilers must resolve the member of this static field to the
334      * identifier of the field name.
335      */
336     public static final Value.Boolean.Member disabled = new Value.Boolean.Member(Members.disabled);
337     /**
338      * <p>An <b>opaque</b> static field defining a member that is named by the field name
339      * without a qualifying member and to access the property of the name on an object.</p>
340      * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
341      * is a read-only reference to the URL of a stylesheet that is linked to the 
342      * document or <tt>null</tt> for inline style-sheets.</p> 
343      * @since 1.0
344      * @javascript Re-compilers must resolve the member of this static field to the
345      * identifier of the field name.
346      */
347     public static final Value.String.Member href = new Value.String.Member(Members.href);
348     /**
349      * <p>An <b>opaque</b> static field defining a member that is named by the field name
350      * without a qualifying member and to access the property of the name on an object.</p>
351      * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
352      * is a read-only reference to the stylesheet that includes this one or <tt>null</tt> 
353      * if this stylesheet was included directly in the document.</p> 
354      * @since 1.0
355      * @javascript Re-compilers must resolve the member of this static field to the
356      * identifier of the field name.
357      */
358     public static final JsCSSStyleSheet.Member parentStyleSheet = new JsCSSStyleSheet.Member(Members.parentStyleSheet);
359     /**
360      * <p>An <b>opaque</b> static field defining a member that is named by the field name
361      * without a qualifying member and to access the property of the name on an object.</p>
362      * <p>The IE equivalent of {@link #cssRules} that is DOM-standard.</p> 
363      * @since 1.0
364      * @see #cssRules
365      * @javascript Re-compilers must resolve the member of this static field to the
366      * identifier of the field name.
367      */
368     public static final JsArray.Member rules = new JsArray.Member(Members.rules);
369     /**
370      * <p>An <b>opaque</b> static field defining a member that is named by the field name
371      * without a qualifying member and to access the property of the name on an object.</p>
372      * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
373      * is a read-only reference to the title of the stylesheet, if specified. A 
374      * title may be specified by the <tt>title</tt> attribute of a <tt>&lt;style&gt;</tt> 
375      * or <tt>&lt;link&gt;</tt> element that refers to this stylesheet.</p> 
376      * @since 1.0
377      * @javascript Re-compilers must resolve the member of this static field to the
378      * identifier of the field name.
379      */
380     public static final Value.String.Member title = new Value.String.Member(Members.title);
381     /**
382      * <p>An <b>opaque</b> static field defining a member that is named by the field name
383      * without a qualifying member and to access the property of the name on an object.</p>
384      * <p>The property, identified by this member, of a {@link JsCSSStyleSheet} object 
385      * is a read-only reference to the type of this stylesheet, as a MIME type. CSS 
386      * style-sheets have a type of "text/css".</p> 
387      * @since 1.0
388      * @javascript Re-compilers must resolve the member of this static field to the
389      * identifier of the field name.
390      */
391     public static final Value.String.Member type  = new Value.String.Member(Members.type );
392 
393     @Override
394     /**
395      * <p>Returns the primitive value associated with the current instance, if there is one.
396      * This invocation simply returns the instance itself for the current instance is an 
397      * object and there is no primitive value for it.</p>
398      * @return The current object itself.
399      * @since 1.0
400      * @javascript Re-compilers must convert the instance invocation of this method directly
401      * into a JavaScript invocation on its current object instance without changing the 
402      * method name, but expanding variable arguments, if any, into comma-separated values. 
403      */
404     public JsCSSStyleSheet valueOf() {
405         return new JsCSSStyleSheet((JsObject)var().valueOf());
406     }
407     /**
408      * <p>IE-specific method to add a CSS rule to a stylesheet.</p>
409      * <p>This method inserts (or appends) a new CSS style rule at the specified <tt>index</tt> 
410      * of the {@link #rules} array of this stylesheet. This is an IE-specific alternative 
411      * to the standard {@link #insertRule(String, long)} method. Note that the arguments 
412      * to this method are different from those to {@link #insertRule(String, long)}.</p>
413      * @param selector The CSS selector for the rule.
414      * @param style The styles to be applied to elements that match the <tt>selector</tt>. 
415      * This style string is a semicolon-delimited list of attribute:value pairs. It does 
416      * NOT begin and end with curly braces.
417      * @param index The position in the {@link #rules} array at which the rule is to be 
418      * inserted or appended. If this optional argument is undefined, the new rule is 
419      * appended to the array of rules.
420      * @since 1.0
421      * @see #insertRule(String, long)
422      * @javascript Re-compilers must convert the instance invocation of this method directly
423      * into a JavaScript invocation on its current object instance without changing the 
424      * method name, but expanding variable arguments, if any, into comma-separated values. 
425      */
426     public final void addRule(String selector, String style, int index) {
427         call(addRule, new Vars<Object>().add(selector).add(style).add(index));
428     }
429     /**
430      * <p>DOM-standard method to delete the rule at the specified position.</p>
431      * <p>This is a DOM-standard method that deletes the rule at the specified <tt>index</tt> 
432      * from the {@link #cssRules} array. See {@link #removeRule(int)} for an IE-specific 
433      * alternative.</p>
434      * @param index The index within the {@link #cssRules} array of the rule to be deleted.
435      * @throws RuntimeException JavaScript throws a {@link JsDOMException} object with 
436      * the {@link JsDOMException#code} property of the value {@link JsDOMException#INDEX_SIZE_ERR} 
437      * if <tt>index</tt> is negative or greater than or equal to the length of the {@link #cssRules} 
438      * array, or the value {@link JsDOMException#NO_MODIFICATION_ALLOWED_ERR} if this 
439      * stylesheet is read-only. See {@link Js#err(Object)} for JS Simulation.
440      * @since 1.0
441      * @see #removeRule(int)
442      * @javascript Re-compilers must convert the instance invocation of this method directly
443      * into a JavaScript invocation on its current object instance without changing the 
444      * method name, but expanding variable arguments, if any, into comma-separated values. 
445      */
446     public final void deleteRule(long index) {
447         call(deleteRule, index);
448     }
449     /**
450      * <p>DOM-standard method to insert a new rule into the stylesheet.</p>
451      * <p>This is a DOM-standard method which inserts (or appends) a new CSS <tt>rule</tt> 
452      * at the specified <tt>index</tt> of the {@link #cssRules} array of this stylesheet. 
453      * See {@link #addRule(String, String, int)} for an IE-specific alternative.</p>
454      * @param rule The complete and parseable text representation of the rule to be 
455      * added to the stylesheet. For style rules, it includes both the element selector 
456      * and the style information.
457      * @param index The position in the {@link #cssRules} array at which the rule is to 
458      * be inserted or appended.
459      * @return The value of the <tt>index</tt> argument.
460      * @throws RuntimeException JavaScript throws a {@link JsDOMException} object with 
461      * the {@link JsDOMException#code} property of the value {@link JsDOMException#NO_MODIFICATION_ALLOWED_ERR} 
462      * if the stylesheet is read-only, the value {@link JsDOMException#INDEX_SIZE_ERR} 
463      * if <tt>index</tt> is negative or greater then the length of the {@link #cssRules} 
464      * array, the value {@link JsDOMException#HIERARCHY_REQUEST_ERR} if CSS syntax does 
465      * not allow the specified rule at the specified location, or the value {@link JsDOMException#SYNTAX_ERR} 
466      * if the specified <tt>rule</tt> text contains a syntax error. See {@link Js#err(Object)} 
467      * for JS Simulation.
468      * @since 1.0
469      * @see #addRule(String, String, int)
470      * @javascript Re-compilers must convert the instance invocation of this method directly
471      * into a JavaScript invocation on its current object instance without changing the 
472      * method name, but expanding variable arguments, if any, into comma-separated values. 
473      */
474     public final Number insertRule(String rule, long index) {
475         return call(insertRule, new Vars<Object>().add(rule).add(index));
476     }
477     /**
478      * <p>IE-specific method to delete a rule.</p>
479      * <p>This method removes the CSS style rule at the specified <tt>index</tt> of the 
480      * {@link #rules} array of this stylesheet. This is an IE-specific alternative to 
481      * the DOM-standard {@link #deleteRule(long)} method.</p>
482      * @param index The index in the {@link #rules} array of the rule to be removed. If 
483      * this optional argument is undefined, the first rule in the array is removed.
484      * @since 1.0
485      * @see #deleteRule(long)
486      * @javascript Re-compilers must convert the instance invocation of this method directly
487      * into a JavaScript invocation on its current object instance without changing the 
488      * method name, but expanding variable arguments, if any, into comma-separated values. 
489      */
490     public final void removeRule(int index) {
491         call(removeRule, index);
492     }
493 }