-
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 Node
lastChild
property (#20085)
Co-authored-by: skyclouds2001 <[email protected]> Co-authored-by: Jason Lam <[email protected]>
- Loading branch information
1 parent
25079cb
commit c9731cf
Showing
1 changed file
with
19 additions
and
10 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,27 +1,36 @@ | ||
--- | ||
title: Node.lastChild | ||
title: Node:lastChild 属性 | ||
slug: Web/API/Node/lastChild | ||
l10n: | ||
sourceCommit: 7de82e7152a2891e9aee5b6f630f1f43849748df | ||
--- | ||
|
||
{{APIRef()}} | ||
{{APIRef("DOM")}} | ||
|
||
## 概述 | ||
{{domxref("Node")}} 接口的 **`lastChild`** 只读属性返回节点的最后一个子节点,如果没有子节点,则返回 `null`。 | ||
|
||
**`Node.lastChild`** 是一个只读属性,返回当前节点的最后一个子节点。如果父节点为一个元素节点,则子节点通常为一个元素节点,或一个文本节点,或一个注释节点。如果没有子节点,则返回 `null`。 | ||
> **备注:** 此属性返回作为此节点最后一个子节点的任何类型的节点。它可能是 {{domxref("Text")}} 或 {{domxref("Comment")}} 节点。如果你要获取另一个元素的最后一个 {{domxref("Element")}} 子元素,可以考虑使用 {{domxref("Element.lastElementChild")}}。 | ||
## 语法 | ||
## 值 | ||
|
||
```plain | ||
var last_child = element.lastChild | ||
``` | ||
作为节点最后一个子节点的 {{domxref("Node")}},如果没有子节点,则为 `null`。 | ||
|
||
## 示例 | ||
|
||
```js | ||
var tr = document.getElementById("row1"); | ||
var corner_td = tr.lastChild; | ||
const tr = document.getElementById("row1"); | ||
const corner_td = tr.lastChild; | ||
``` | ||
|
||
## 规范 | ||
|
||
{{Specifications}} | ||
|
||
## 浏览器兼容性 | ||
|
||
{{Compat}} | ||
|
||
## 参见 | ||
|
||
- {{domxref("Node.firstChild")}} | ||
- {{domxref("Element.lastElementChild")}} |