CSSNamespaceRule
The CSSNamespaceRule
interface describes an object representing a single CSS @namespace
at-rule
.
Properties
Inherits methods from its ancestor CSSRule
.
CSSNamespaceRule.namespaceURI
-
Returns a
DOMString
containing the text of the URI of the given namespace. CSSNamespaceRule.prefix
-
Returns a
DOMString
with the name of the prefix associated to this namespace. If there is no such prefix, returns an empty string.
Methods
Inherits methods from its ancestor CSSRule
.
Examples
The stylesheet includes a namespace as the only rule. Therefore the first CSSRule
returned will be a CSSNamespaceRule
.
@namespace url(http://www.w3.org/1999/xhtml);
let myRules = document.styleSheets[0].cssRules; console.log(myRules[0]); //a CSSNamespaceRule
Specifications
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
CSSNamespaceRule |
47 |
12 |
53 |
9 |
36 |
10.1 |
47 |
47 |
53 |
36 |
10.3 |
5.0 |
namespaceURI |
47 |
12 |
59 |
9 |
36 |
10.1 |
47 |
47 |
59 |
36 |
10.3 |
5.0 |
prefix |
47 |
12 |
59 |
9 |
36 |
10.1 |
47 |
47 |
59 |
36 |
10.3 |
5.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSSNamespaceRule