-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zh-cn: update the translation of
Element.prefix
- Loading branch information
Showing
1 changed file
with
13 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,40 @@ | ||
--- | ||
title: Element.prefix | ||
title: Element:prefix 属性 | ||
slug: Web/API/Element/prefix | ||
l10n: | ||
sourceCommit: bbf7f25f9cf95fb154e2740a9fdc9c02818981bf | ||
--- | ||
|
||
{{APIRef("DOM")}} | ||
|
||
**`Element.prefix`** 只读属性返回指定元素的命名空间前缀,如果未指定前缀,则返回 null。 | ||
**`Element.prefix`** 只读属性返回指定元素的命名空间前缀,如果未指定前缀,则返回 `null`。 | ||
|
||
> [!NOTE] | ||
> 在 DOM4 之前,该 API 是在 {{domxref("Node")}} interface 中定义的。 | ||
## 值 | ||
|
||
## Syntax | ||
字符串。 | ||
|
||
``` | ||
string = element.prefix | ||
``` | ||
|
||
## Examples | ||
## 示例 | ||
|
||
The following logs "x" to the console. | ||
以下代码在控制台中打印“x”。 | ||
|
||
```xml | ||
<x:div onclick="console.log(this.prefix)"/> | ||
``` | ||
|
||
## Notes | ||
## 备注 | ||
|
||
This will only work when a namespace-aware parser is used, i.e. when a document is served with an XML MIME type. This will not work for HTML documents. | ||
仅当使用可感知命名空间的解析器时(即,当文档以 XML MIME 类型提供时),此属性才有效。对于 HTML 文档,此属性无效。 | ||
|
||
## Specifications | ||
## 规范 | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
## 浏览器兼容性 | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
## 参见 | ||
|
||
- {{domxref("Element.namespaceURI")}} | ||
- {{domxref("Element.localName")}} | ||
- {{domxref("Attr.prefix")}} | ||
- {{domxref("Node.prefix")}} |