-
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 Range
setStartBefore()
method
- Loading branch information
1 parent
21ea6fd
commit 46e0f4a
Showing
1 changed file
with
21 additions
and
15 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,40 +1,46 @@ | ||
--- | ||
title: Range.setStartBefore() | ||
title: Range:setStartBefore() 方法 | ||
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` 的父节点相同。 | ||
|
||
## 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) |