Attr.prefix
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Attr.prefix
为只读属性,返回指定标签属性的名字空间前缀,如果没有前缀则返回 null
。
备注:
在 DOM4 之前此 API 被定义在 Node
接口中。
示例
下例在控制台中输出“x”。
xml
<div x:id="example" onclick="console.log(this.attributes[0].prefix)"/>
注意
该属性仅在使用有名字空间解析功能的解析器时有效,例如一个 MIME 类型为 XML 的文档。在 HTML 文档中无效。
规范
Specification |
---|
DOM # dom-attr-prefix |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
prefix |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.