CSSNamespaceRule

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

CSSNamespaceRule interface describes an object representing a single CSS @namespace at-rule . It implements the CSSRule interface, with a type value of 10 ( CSSRule.NAMESPACE_RULE ).

句法

The syntax is described using the WebIDL format.

interface CSSNamespaceRule : CSSRule {
    readonly attribute DOMString namespaceURI;
    readonly attribute DOMString? prefix;
};
					

特性

As a CSSRule , CSSNamespaceRule also implements the properties of that interface. It has some specific properties:

CSSNamespaceRule.namespaceURI
返回 DOMString containing the text of the URI of the given namespace.
CSSNamespaceRule.prefix
返回 DOMString with the name of the prefix associated to this namespace. If there is no such prefix, returns null .

方法

As a CSSRule , CSSNamespaceRule also implements the methods of that interface. It has no specific methods:

规范

规范 状态 Comment
CSS Object Model (CSSOM)
The definition of 'CSSNamespaceRule' in that specification.
工作草案 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
CSSNamespaceRule Chrome 47 Edge ≤18 Firefox 59 IE No Opera 36 Safari Yes WebView Android 47 Chrome Android 47 Firefox Android 59 Opera Android 36 Safari iOS Yes Samsung Internet Android 5.0
namespaceURI Chrome 47 Edge 12 Firefox 59 IE No Opera 36 Safari Yes WebView Android 47 Chrome Android 47 Firefox Android 59 Opera Android 36 Safari iOS Yes Samsung Internet Android 5.0
prefix Chrome 47 Edge 12 Firefox 59 IE No Opera 36 Safari Yes WebView Android 47 Chrome Android 47 Firefox Android 59 Opera Android 36 Safari iOS Yes Samsung Internet Android 5.0

图例

完整支持
完整支持
不支持
不支持