Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

T34-active
Copy link
Contributor

@T34-active T34-active requested a review from a team as a code owner December 24, 2024 08:11
@T34-active T34-active requested review from jasonren0403 and removed request for a team December 24, 2024 08:11
@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Dec 24, 2024
Copy link
Contributor

Preview URLs

---

{{APIRef("DOM")}}

**`Element.prepend`** 方法可以在父节点的第一个子节点之前插入一系列{{domxref("Node")}}对象或者{{domxref("DOMString")}}对象。{{domxref("DOMString")}}会被当作{{domxref("Text")}}节点对待(也就是说插入的不是 HTML 代码)
**`Element.prepend()`** 方法将在 {{domxref("Element")}} 的第一个子节点之前插入一组 {{domxref("Node")}} 对象或字符串。字符串将作为等效的 {{domxref("Text")}} 节点插入
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**`Element.prepend()`** 方法将在 {{domxref("Element")}} 的第一个子节点之前插入一组 {{domxref("Node")}} 对象或字符串。字符串将作为等效的 {{domxref("Text")}} 节点插入。
**`Element.prepend()`** 方法将在当前{{domxref("Element", "元素", "", 1)}}的第一个子节点之前插入一组 {{domxref("Node")}} 对象或字符串。字符串将以等效的 {{domxref("Text")}} 节点插入。

```

### 参数

- `nodes`
- : 要插入的一系列{{domxref("Node")}}或者{{domxref("DOMString")}}。
- `param1`, …, `paramN`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `param1`, …, `paramN`
- `param1`、……、`paramN`


console.log(parent.childNodes); // NodeList [ <span>, <p> ]
console.log(div.childNodes); // 节点列表 [ <span>, <p> ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NodeList 是接口名,实际按这个代码运行得到的就是“NodeList”(它是不会被翻译的)

Suggested change
console.log(div.childNodes); // 节点列表 [ <span>, <p> ]
console.log(div.childNodes); // NodeList [ <span>, <p> ]


console.log(parent.textContent); // "Headline: Some text"
console.log(div.textContent); // "标题:一些文本"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(div.textContent); // "标题:一些文本"
console.log(div.textContent); // 标题:一些文本


console.log(parent.childNodes); // NodeList [ #text "Some text", <p> ]
console.log(div.childNodes); // 节点列表 [ #text "一些文本", <p> ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(div.childNodes); // 节点列表 [ #text "一些文本", <p> ]
console.log(div.childNodes); // NodeList [ #text "一些文本", <p> ]

```

### `Element.prepend()` is unscopable
### prepend 方法是不可访问的
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注意:在遇到不确定翻译的术语时,请通过 GitHub 的审查功能留下评论,或给出术语的翻译来源。

我们曾经讨论过 unscopable 的翻译

现在又考虑了一下,可能将“unscopable”翻译成“不可绑定作用域”会更好一些,但有一点冗长

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注意:在遇到不确定翻译的术语时,请通过 GitHub 的审查功能留下评论,或给出术语的翻译来源。

我们曾经讨论过 unscopable 的翻译

现在又考虑了一下,可能将“unscopable”翻译成“不可绑定作用域”会更好一些,但有一点冗长

不可作用域化,这个可以吗


`prepend()` 不能在 with 语句内使用,详情参考 {{jsxref("Symbol.unscopables")}}。
`prepend()` 方法不在 `with` 语句中作用域内。有关更多信息,请参阅 {{jsxref("Symbol.unscopables")}}。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`prepend()` 方法不在 `with` 语句中作用域内。有关更多信息,请参阅 {{jsxref("Symbol.unscopables")}}。
`prepend()` 方法无法绑定到 `with` 语句中的作用域。有关更多信息,请参阅 {{jsxref("Symbol.unscopables")}}。

@yin1999 yin1999 changed the title [zh-cn]: update the translation of Element prepend() method [zh-cn]: update the translation of Element.prepend() method Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n-zh Issues related to Chinese content.
Projects
Status: In progress - PRs
Development

Successfully merging this pull request may close these issues.

Chinese translation of Element.prepend() page
2 participants