CSSRule.parentStyleSheet

The parentStyleSheet property of the CSSRule interface returns the StyleSheet object in which the current rule is defined.

Syntax

var stylesheet = cssRule.parentStyleSheet

Parameters

Example

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

Specifications

Specification Status Comment
CSS Object Model (CSSOM)
The definition of 'CSSRule: parentStyleSheet' in that specification.
Working Draft

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
parentStyleSheetChrome Full support 1Edge Full support 12Firefox Full support 1IE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 1.0

Legend

Full support
Full support
Compatibility unknown
Compatibility unknown