blob: 5fa9cb99a66389b02b754a661430466a6bba3d4c [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!-- CSSStyleDeclaration interface -->
<interface name="CSSStyleDeclaration" id="CSS-CSSStyleDeclaration"
since="DOM Level 2">
<descr>
<p>
The <code>CSSStyleDeclaration</code> interface represents a single
<xspecref href="&css2;/syndata.html#block">CSS declaration block</xspecref>. This interface may be used to determine the style properties
currently set in a block or to set style properties explicitly within
the block.
</p>
<p>
While an implementation may not recognize all CSS properties within a CSS
declaration block, it is expected to provide access to all specified
properties in the style sheet through the
<code>CSSStyleDeclaration</code> interface. Furthermore, implementations
that support a specific level of CSS should correctly handle <xspecref
href="&css2;/about.html#shorthand">CSS shorthand</xspecref> properties
for that level. For a further discussion of shorthand properties, see the
<code>CSS2Properties</code> interface.
</p>
<p>
This interface is also used to provide a <b>read-only</b> access to the
<xspecref href="&css2;/cascade.html#computed-value">computed
values</xspecref> of an element. See also the <code>ViewCSS</code>
interface.
</p>
<note>
<p>
The CSS Object Model doesn't provide an access to the <xspecref
href="&css2;/cascade.html#specified-value">specified</xspecref> or
<xspecref
href="&css2;/cascade.html#specified-value">actual</xspecref> values of the
CSS cascade.
</p>
</note>
</descr>
<attribute type="DOMString" name="cssText" id="CSS-CSSStyleDeclaration-cssText">
<descr>
<p>
The parsable textual representation of the declaration block (excluding
the surrounding curly braces). Setting this attribute will result in
the parsing of the new value and resetting of all the properties in the
declaration block including the removal or addition of properties.
</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>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
readonly or a property is readonly.</p>
</descr>
</exception>
</setraises>
</attribute>
<method name="getPropertyValue" id="CSS-CSSStyleDeclaration-getPropertyValue">
<descr>
<p>
Used to retrieve the value of a CSS property if it has been explicitly
set within this declaration block.
</p>
</descr>
<parameters>
<param name="propertyName" type="DOMString" attr="in">
<descr>
<p>
The name of the CSS property. See the <xspecref href="&css2;/propidx.html">CSS property index</xspecref>.
</p>
</descr>
</param>
</parameters>
<returns type="DOMString">
<descr>
<p>
Returns the value of the property if it has been explicitly set
for this declaration block. Returns the empty string if the property
has not been set.
</p>
</descr>
</returns>
<raises>
<!-- No exceptions -->
</raises>
</method>
<method name="getPropertyCSSValue" id="CSS-CSSStyleDeclaration-getPropertyCSSValue">
<descr>
<p>
Used to retrieve the object representation of the value of a CSS
property if it has been explicitly set within this declaration block.
This method returns <code>null</code> if the property is a <xspecref href="&css2;/about.html#shorthand">shorthand</xspecref> property. Shorthand
property values can only be accessed and modified as strings, using
the <code>getPropertyValue</code> and <code>setProperty</code> methods.
</p>
</descr>
<parameters>
<param name="propertyName" type="DOMString" attr="in">
<descr>
<p>
The name of the CSS property. See the <xspecref href="&css2;/propidx.html">CSS property index</xspecref>.
</p>
</descr>
</param>
</parameters>
<returns type="CSSValue">
<descr>
<p>
Returns the value of the property if it has been explicitly set for
this declaration block. Returns <code>null</code> if the property
has not been set.
</p>
</descr>
</returns>
<raises>
<!-- No exceptions -->
</raises>
</method>
<method name="removeProperty" id="CSS-CSSStyleDeclaration-removeProperty">
<descr>
<p>
Used to remove a CSS property if it has been explicitly
set within this declaration block.
</p>
</descr>
<parameters>
<param name="propertyName" type="DOMString" attr="in">
<descr>
<p>
The name of the CSS property. See the <xspecref href="&css2;/propidx.html">CSS property index</xspecref>.
</p>
</descr>
</param>
</parameters>
<returns type="DOMString">
<descr>
<p>
Returns the value of the property if it has been explicitly set
for this declaration block. Returns the empty string if the property
has not been set or the property name does not correspond to
a known CSS property.
</p>
</descr>
</returns>
<raises>
<exception name="DOMException">
<descr>
<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
readonly or the property is readonly.</p>
</descr>
</exception>
</raises>
</method>
<method name="getPropertyPriority" id="CSS-CSSStyleDeclaration-getPropertyPriority">
<descr>
<p>
Used to retrieve the priority of a CSS property
(e.g. the <code>"important"</code> qualifier) if the property
has been explicitly set in this declaration block.
</p>
</descr>
<parameters>
<param name="propertyName" type="DOMString" attr="in">
<descr>
<p>
The name of the CSS property. See the <xspecref
href="&css2;/propidx.html">CSS property
index</xspecref>.
</p>
</descr>
</param>
</parameters>
<returns type="DOMString">
<descr>
<p>
A string representing the priority (e.g. <code>"important"</code>)
if one exists. The empty string if none exists.
</p>
</descr>
</returns>
<raises>
<!-- No exceptions -->
</raises>
</method>
<method name="setProperty" id="CSS-CSSStyleDeclaration-setProperty">
<descr>
<p>
Used to set a property value and priority within this declaration
block.
</p>
</descr>
<parameters>
<param name="propertyName" type="DOMString" attr="in">
<descr>
<p>
The name of the CSS property. See the <xspecref href="&css2;/propidx.html">CSS property index</xspecref>.
</p>
</descr>
</param>
<param name="value" type="DOMString" attr="in">
<descr>
<p>
The new value of the property.
</p>
</descr>
</param>
<param name="priority" type="DOMString" attr="in">
<descr>
<p>
The new priority of the property (e.g. <code>"important"</code>).
</p>
</descr>
</param>
</parameters>
<returns type="void">
<descr>
<p>
</p>
</descr>
</returns>
<raises>
<exception name="DOMException">
<descr>
<p>SYNTAX_ERR: Raised if the specified value has a syntax error
and is unparsable.</p>
<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
readonly or the property is readonly.</p>
</descr>
</exception>
</raises>
</method>
<attribute type="unsigned long" readonly="yes" name="length" id="CSS-CSSStyleDeclaration-length">
<descr>
<p>
The number of properties that have been explicitly set in this
declaration block. The range of valid indices is 0 to length-1
inclusive.
</p>
</descr>
</attribute>
<method name="item" id="CSS-CSSStyleDeclaration-item">
<descr>
<p>
Used to retrieve the properties that have been explicitly set in
this declaration block. The order of the properties retrieved using
this method does not have to be the order in which they were set.
This method can be used to iterate over all properties in this
declaration block.
</p>
</descr>
<parameters>
<param name="index" type="unsigned long" attr="in">
<descr>
<p>
Index of the property name to retrieve.
</p>
</descr>
</param>
</parameters>
<returns type="DOMString">
<descr>
<p>
The name of the property at this ordinal position. The empty string
if no property exists at this position.
</p>
</descr>
</returns>
<raises>
<!-- No exceptions -->
</raises>
</method>
<attribute type="CSSRule" readonly="yes" name="parentRule" id="CSS-CSSStyleDeclaration-parentRule">
<descr>
<p>
The CSS rule that contains this declaration block or <code>null</code>
if this <code>CSSStyleDeclaration</code> is not attached to a
<code>CSSRule</code>.
</p>
</descr>
</attribute>
</interface>