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 Range endOffset property #23177

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions files/zh-cn/web/api/range/endoffset/index.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
---
title: Range.endOffset
title: RangeendOffset 属性
slug: Web/API/Range/endOffset
l10n:
sourceCommit: c58e8c1dd6ecbcb63894c7dd17fb9495b9511b4e
---

{{ApiRef("DOM")}}

只读属性 **`Range.endOffset`** 返回代表 `Range` 结束位置在 {{domxref("Range.endContainer")}} 中的偏移值的数字
**`Range.endOffset`** 只读属性返回一个数字,表示 {{domxref("Range.endContainer")}} 在 {{domxref("Range")}} 中的结束位置

如果 `endContainer` {{domxref("Node")}} 类型为 {{domxref("Text")}}, {{domxref("Comment")}},或 {{domxref("CDATASection")}},偏移值是 `endContainer` 节点开头到 {{domxref("Range")}} 末尾的总字符个数。对其他类型的 {{domxref("Node")}} `endOffset` `endContainer` 开头到 {{domxref("Range")}} 末尾的总 {{domxref("Node")}} 个数。如需修改 `endOffset` 的值,使用 {{domxref("Range.setEnd")}} 方法。
如果 `endContainer` {{domxref("Text")}}{{domxref("Comment")}}{{domxref("CDATASection")}} 类型的 {{domxref("Node")}},那么偏移量是从 `endContainer` 的起始位置到 {{domxref("Range")}} 边界点之间的字符数。对于其他的 {{domxref("Node")}} 类型,`endOffset` 是从 `endContainer` 的起始位置到 {{domxref("Range")}} 边界点之间的子节点数。此属性为只读。要更改 {{domxref("Range")}} `endOffset` 方法,请使用 {{domxref("Range.setEnd")}} 方法。
T34-active marked this conversation as resolved.
Show resolved Hide resolved

## 语法
##

```
endRangeOffset = range.endOffset;
```
数字。

## 示例

```js
var range = document.createRange();
const range = document.createRange();

range.setStart(startNode, startOffset);
range.setEnd(endNode, endOffset);
Expand All @@ -35,4 +35,4 @@ endRangeOffset = range.endOffset;

## 参见

- [The DOM interfaces index](/zh-CN/docs/DOM/DOM_Reference)
- [DOM 接口索引](/zh-CN/docs/Web/API/Document_Object_Model)