<?xml version="1.0" encoding="utf-8"?> <!-- CSSRule interface --> <interface name="CSSRule" id="CSS-CSSRule" since="DOM Level 2"> <descr> <p> The <code>CSSRule</code> interface is the abstract base interface for any type of CSS <xspecref href="&css2;/syndata.html#q5">statement</xspecref>. This includes both <xspecref href="&css2;/syndata.html#q8">rule sets</xspecref> and <xspecref href="&css2;/syndata.html#at-rules">at-rules</xspecref>. An implementation is expected to preserve all rules specified in a CSS style sheet, even if the rule is not recognized by the parser. Unrecognized rules are represented using the <code>CSSUnknownRule</code> interface. </p> </descr> <group id="CSS-CSSRule-ruleType" name="RuleType"> <descr><p>An integer indicating which type of rule this is.</p></descr> <constant name="UNKNOWN_RULE" type="unsigned short" value="0"> <descr><p>The rule is a <code>CSSUnknownRule</code>.</p></descr> </constant> <constant name="STYLE_RULE" type="unsigned short" value="1"> <descr><p>The rule is a <code>CSSStyleRule</code>.</p></descr> </constant> <constant name="CHARSET_RULE" type="unsigned short" value="2"> <descr><p>The rule is a <code>CSSCharsetRule</code>.</p></descr> </constant> <constant name="IMPORT_RULE" type="unsigned short" value="3"> <descr><p>The rule is a <code>CSSImportRule</code>.</p></descr> </constant> <constant name="MEDIA_RULE" type="unsigned short" value="4"> <descr><p>The rule is a <code>CSSMediaRule</code>.</p></descr> </constant> <constant name="FONT_FACE_RULE" type="unsigned short" value="5"> <descr><p>The rule is a <code>CSSFontFaceRule</code>.</p></descr> </constant> <constant name="PAGE_RULE" type="unsigned short" value="6"> <descr><p>The rule is a <code>CSSPageRule</code>.</p></descr> </constant> </group> <attribute type="unsigned short" readonly="yes" name="type" id="CSS-CSSRule-type"> <descr> <p> The type of the rule, as defined above. The expectation is that binding-specific casting methods can be used to cast down from an instance of the <code>CSSRule</code> interface to the specific derived interface implied by the <code>type</code>. </p> </descr> </attribute> <attribute type="DOMString" name="cssText" id="CSS-CSSRule-cssText"> <descr> <p> The parsable textual representation of the rule. This reflects the current state of the rule and not its initial value. </p> </descr> <setraises> <exception name="DOMException"> <descr> <p>SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable.</p> <p>INVALID_MODIFICATION_ERR: Raised if the specified CSS string value represents a different type of rule than the current one.</p> <p>HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at this point in the style sheet.</p> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.</p> </descr> </exception> </setraises> </attribute> <attribute type="CSSStyleSheet" readonly="yes" name="parentStyleSheet" id="CSS-CSSRule-sheet"> <descr> <p> The style sheet that contains this rule. </p> </descr> </attribute> <attribute type="CSSRule" readonly="yes" name="parentRule" id="CSS-CSSRule-parentRule"> <descr> <p> If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns <code>null</code>. </p> </descr> </attribute> </interface>