We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

这篇翻译不完整。请帮忙从英语翻译这篇文章

Attr.prefix 为只读属性,返回这个Attr的prefix,如果未被赋值则返回null

在DOM4之前此API被定义于Node接口中。

语法

string = attribute.prefix

例子

在console中输出"x"。

<div x:id="example" onclick="console.log(this.attributes[0].prefix)"/>

注意

该属性仅在命名空间感知的解析器被使用时有效,如:当文件以 XML MIME 类型被解析时。在HTML 文档中无效.

规格

规格 状态 注释
DOM4
Attr.prefix
Obsolete Initial definition

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 46.0[1] (Yes) 48.0 (48.0)[1] ? (Yes) ?
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? (Yes) 48.0 (48.0)[1] ? ? ?

[1] This API was previously available on the Node API.

参考

文档标签和贡献者

此页面的贡献者: holynewbie, lixuanh
最后编辑者: holynewbie,