-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[zh-cn]: update the translation of Element.prepend()
method
#25223
base: main
Are you sure you want to change the base?
Conversation
Preview URLs |
--- | ||
|
||
{{APIRef("DOM")}} | ||
|
||
**`Element.prepend`** 方法可以在父节点的第一个子节点之前插入一系列{{domxref("Node")}}对象或者{{domxref("DOMString")}}对象。{{domxref("DOMString")}}会被当作{{domxref("Text")}}节点对待(也就是说插入的不是 HTML 代码)。 | ||
**`Element.prepend()`** 方法将在 {{domxref("Element")}} 的第一个子节点之前插入一组 {{domxref("Node")}} 对象或字符串。字符串将作为等效的 {{domxref("Text")}} 节点插入。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**`Element.prepend()`** 方法将在 {{domxref("Element")}} 的第一个子节点之前插入一组 {{domxref("Node")}} 对象或字符串。字符串将作为等效的 {{domxref("Text")}} 节点插入。 | |
**`Element.prepend()`** 方法将在当前{{domxref("Element", "元素", "", 1)}}的第一个子节点之前插入一组 {{domxref("Node")}} 对象或字符串。字符串将以等效的 {{domxref("Text")}} 节点插入。 |
``` | ||
|
||
### 参数 | ||
|
||
- `nodes` | ||
- : 要插入的一系列{{domxref("Node")}}或者{{domxref("DOMString")}}。 | ||
- `param1`, …, `paramN` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `param1`, …, `paramN` | |
- `param1`、……、`paramN` |
|
||
console.log(parent.childNodes); // NodeList [ <span>, <p> ] | ||
console.log(div.childNodes); // 节点列表 [ <span>, <p> ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NodeList 是接口名,实际按这个代码运行得到的就是“NodeList”(它是不会被翻译的)
console.log(div.childNodes); // 节点列表 [ <span>, <p> ] | |
console.log(div.childNodes); // NodeList [ <span>, <p> ] |
|
||
console.log(parent.textContent); // "Headline: Some text" | ||
console.log(div.textContent); // "标题:一些文本" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(div.textContent); // "标题:一些文本" | |
console.log(div.textContent); // “标题:一些文本” |
|
||
console.log(parent.childNodes); // NodeList [ #text "Some text", <p> ] | ||
console.log(div.childNodes); // 节点列表 [ #text "一些文本", <p> ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(div.childNodes); // 节点列表 [ #text "一些文本", <p> ] | |
console.log(div.childNodes); // NodeList [ #text "一些文本", <p> ] |
``` | ||
|
||
### `Element.prepend()` is unscopable | ||
### prepend 方法是不可访问的 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意:在遇到不确定翻译的术语时,请通过 GitHub 的审查功能留下评论,或给出术语的翻译来源。
现在又考虑了一下,可能将“unscopable”翻译成“不可绑定作用域”会更好一些,但有一点冗长
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意:在遇到不确定翻译的术语时,请通过 GitHub 的审查功能留下评论,或给出术语的翻译来源。
现在又考虑了一下,可能将“unscopable”翻译成“不可绑定作用域”会更好一些,但有一点冗长
不可作用域化,这个可以吗
|
||
`prepend()` 不能在 with 语句内使用,详情参考 {{jsxref("Symbol.unscopables")}}。 | ||
`prepend()` 方法不在 `with` 语句中作用域内。有关更多信息,请参阅 {{jsxref("Symbol.unscopables")}}。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`prepend()` 方法不在 `with` 语句中作用域内。有关更多信息,请参阅 {{jsxref("Symbol.unscopables")}}。 | |
`prepend()` 方法无法绑定到 `with` 语句中的作用域。有关更多信息,请参阅 {{jsxref("Symbol.unscopables")}}。 |
prepend()
methodElement.prepend()
method
Description
Related issues and pull requests