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 setStartBefore() method #23170

Merged
merged 2 commits into from
Aug 23, 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
36 changes: 21 additions & 15 deletions files/zh-cn/web/api/range/setstartbefore/index.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
---
title: Range.setStartBefore()
title: RangesetStartBefore() 方法
slug: Web/API/Range/setStartBefore
l10n:
sourceCommit: c58e8c1dd6ecbcb63894c7dd17fb9495b9511b4e
---

{{ApiRef("DOM")}}

**`Range.setStartBefore()`** 方法相对另一个 {{domxref("Node")}}来设置一个{{domxref("Range")}} 的开始位置。{{domxref("Range")}}的开始节点(focusNode)的父节点,和 `referenceNode`的父节点是同一个
**`Range.setStartBefore()`** 方法将 {{domxref("Range")}} 的起始位置 设置在另一个 {{domxref("Node")}} 之前。{{domxref("Range")}} 起始位置的父 {{domxref("Node")}} 将与 `referenceNode` 的父节点相同
T34-active marked this conversation as resolved.
Show resolved Hide resolved

## Syntax
## 语法

```plain
range.setStartBefore(referenceNode);
```js-nolint
setStartBefore(referenceNode)
```

### Parameters
### 参数

- `referenceNode`
- : {{domxref("Range")}} 应该在其之前开始的 {{domxref("Node")}}。

### 返回值

- _referenceNode_
- : 一个{{domxref("Range")}}新的开始位置上的{{domxref("Node")}}.
无({{jsxref("undefined")}})。

## Example
## 示例

```js
var range = document.createRange();
var referenceNode = document.getElementsByTagName("div").item(0);
const range = document.createRange();
const referenceNode = document.getElementsByTagName("div").item(0);

range.setStartBefore(referenceNode);
```

## Specifications
## 规范

{{Specifications}}

## Browser compatibility
## 浏览器兼容性

{{Compat}}

## See also
## 参见

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