mozilla

Revision 205015 of CSSRule.parentStyleSheet

  • Revision slug: DOM/CSSRule/parentStyleSheet
  • Revision title: parentStyleSheet
  • Revision id: 205015
  • Created:
  • Creator: JesseW
  • Is current revision? No
  • Comment adding another meaning

Revision Content

parentStyleSheet has two meanings:

CSSRule

Summary

parentStyleSheet returns the stylesheet object in which the current rule is defined.

Syntax

stylesheet = cssRule.parentStyleSheet 

Parameters

  • stylesheet is a stylesheet object.

Example

if ( bgRule.parentStyleSheet != mySheet ) {
   // alien style rule!
}

Notes

See Gecko DOM Reference:event#DOM_styleSheet_Object for more information about the stylesheet object interface.

Specification

DOM Level 2 Style - cssRule

CSSStylesheet

Summary

Returns the stylesheet that is including this one, if any.

Syntax

objRef = stylesheet.parentStyleSheet 

Example

// find the top level stylesheet
if (stylesheet.parentStyleSheet) {
  sheet = stylesheet.parentStyleSheet;
}
else
{ sheet = stylesheet; }

Notes

This property returns NULL is the current stylesheet is a top-level stylesheet or if stylesheeet inclusion is not supported.

Specification

parentStyleSheet

Revision Source

<p>
<b>parentStyleSheet</b> has two meanings:
</p>
<ul><li> DOM <a href="#CSSRule">#CSSRule</a> property
</li><li> DOM <a href="#CSSStylesheet">#CSSStylesheet</a> property
</li></ul>
<h3 name="CSSRule">CSSRule</h3>
<h4 name="Summary">Summary</h4>
<p><b>parentStyleSheet</b> returns the stylesheet object in which the current rule is defined. 
</p>
<h3 name="Syntax">Syntax </h3>
<pre class="eval"><i>stylesheet</i> = cssRule.parentStyleSheet 
</pre>
<h3 name="Parameters">Parameters </h3>
<ul><li><code>stylesheet</code> is a stylesheet object.
</li></ul>
<h3 name="Example">Example </h3>
<pre class="eval">if ( bgRule.parentStyleSheet != mySheet ) {
   // alien style rule!
}
</pre>
<h3 name="Notes">Notes </h3>
<p>See <a href="en/Gecko_DOM_Reference/event#DOM_styleSheet_Object">Gecko DOM Reference:event#DOM_styleSheet_Object</a> for more information about the stylesheet object interface. 
</p>
<h3 name="Specification">Specification </h3>
<p>DOM Level 2 Style - cssRule
</p>
<h3 name="CSSStylesheet">CSSStylesheet</h3>
<h4 name="Summary_2">Summary</h4>
<p>Returns the stylesheet that is including this one, if any. 
</p>
<h4 name="Syntax_2">Syntax </h4>
<pre class="eval"><i>objRef</i> = stylesheet.parentStyleSheet 
</pre>
<h4 name="Example_2">Example </h4>
<pre class="eval">// find the top level stylesheet
if (stylesheet.parentStyleSheet) {
  sheet = stylesheet.parentStyleSheet;
}
else
{ sheet = stylesheet; }
</pre>
<h4 name="Notes_2">Notes </h4>
<p>This property returns NULL is the current stylesheet is a top-level stylesheet or if stylesheeet inclusion is not supported. 
</p>
<h4 name="Specification_2">Specification </h4>
<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/stylesheets.html#StyleSheets-StyleSheet-parentStyleSheet">parentStyleSheet </a>
</p>
Revert to this revision