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

chore(zh-cn): add language tags for fenced codes (part 3) #23282

Merged
merged 7 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
14 changes: 1 addition & 13 deletions files/zh-cn/web/api/element/scrollleft/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,7 @@ slug: Web/API/Element/scrollLeft
> [!WARNING]
> 在使用显示比例缩放的系统上,`scrollLeft` 可能会是一个小数。
## 语法

```
//获取滚动条到元素左边的距离
var sLeft = element.scrollLeft;
```

`sLeft`是一个整数,代表元素滚动条距离元素左边多少像素。

```
//设置滚动条滚动了多少像素
element.scrollLeft = 10;
```
##

`scrollLeft` 可以是任意整数,然而:

Expand Down
40 changes: 20 additions & 20 deletions files/zh-cn/web/api/mediarecorder/dataavailable_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ slug: Web/API/MediaRecorder/dataavailable_event
## 语法

```
MediaRecorder.ondataavailable = function(event) { ... }
MediaRecorder.addEventListener('dataavailable', function(event) { ... })
```
在类似 {{domxref("EventTarget.addEventListener", "addEventListener()")}} 这样的方法中使用事件名称,或设置事件处理器属性。

## 示例
```js
addEventListener("dataavailable", (event) => {});

ondataavailable = (event) => {};
```
...
var chunks = [];

mediaRecorder.onstop = function(e) {
console.log("data available after MediaRecorder.stop() called.");
## 示例

```js
const chunks = [];

var audio = document.createElement('audio');
audio.controls = true;
var blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' });
var audioURL = window.URL.createObjectURL(blob);
audio.src = audioURL;
console.log("录像停止");
}
mediaRecorder.onstop = (e) => {
console.log("数据将在调用 MediaRecorder.stop() 后可用。");

mediaRecorder.ondataavailable = function(e) {
chunks.push(e.data);
}
const audio = document.createElement("audio");
audio.controls = true;
const blob = new Blob(chunks, { type: mediaRecorder.mimeType });
const audioURL = window.URL.createObjectURL(blob);
audio.src = audioURL;
console.log("录制停止");
};

...
mediaRecorder.ondataavailable = (e) => {
chunks.push(e.data);
};
```

## 规范
Expand Down
5 changes: 3 additions & 2 deletions files/zh-cn/web/api/mediarecorder/mediarecorder/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ slug: Web/API/MediaRecorder/MediaRecorder

## 语法

```
var mediaRecorder = new MediaRecorder(stream[, options]);
```js-nolint
new MediaRecorder(stream)
new MediaRecorder(stream, options)
```

### 参数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ slug: Web/API/MediaStreamTrack/getConstraints

约束条件可以用来确保媒体符合你喜欢的某些指导方针。例如,你可能更喜欢高清视频,但要求帧率略低,以帮助保持足够低的数据速率而不会使网络负担过重。约束还可以指定理想和/或可接受的尺寸或尺寸范围。有关如何使用可约束属性的详细信息[](/zh-CN/docs/Web/API/Media_Streams_API/Constraints)请参阅[能力,约束和设置](/zh-CN/docs/Web/API/Media_Streams_API/Constraints)

## 句法
## 语法

```
var constraints = MediaStreamTrack.getConstraints();
```js-nolint
getConstraints()
```

### 参数
Expand Down
6 changes: 0 additions & 6 deletions files/zh-cn/web/api/mouseevent/altkey/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ slug: Web/API/MouseEvent/altKey

**`MouseEvent.altKey`** 只读属性是一个{{jsxref("Boolean")}}变量。当事件触发时,如果<kbd>alt</kbd> 被按下,则返回 true,否则返回 false。

## 语法

```
var altKeyPressed = instanceOfMouseEvent.altKey
```

## 示例

```js
Expand Down
8 changes: 4 additions & 4 deletions files/zh-cn/web/api/mouseevent/initmouseevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ slug: Web/API/MouseEvent/initMouseEvent
## 语法

```
event.initMouseEvent(type, canBubble, cancelable, view,
```js-nolint
initMouseEvent(type, canBubble, cancelable, view,
detail, screenX, screenY, clientX, clientY,
ctrlKey, altKey, shiftKey, metaKey,
button, relatedTarget);
button, relatedTarget)
```

### 形参
### 参数

- _`type`_
- : 设置事件类型{{domxref("Event.type", "type")}} 的字符串,包含以下几种鼠标事件:`click``mousedown``mouseup``mouseover``mousemove``mouseout`
Expand Down
8 changes: 1 addition & 7 deletions files/zh-cn/web/api/mouseevent/metakey/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ slug: Web/API/MouseEvent/metaKey
> [!NOTE]
> 在 MAC 键盘上,表示 Command 键(<kbd>⌘</kbd>),在 Windows 键盘上,表示 Windows 键(<kbd>⊞</kbd>)。
## 语法

```
var metaKeyPressed = instanceOfMouseEvent.metaKey
```

### 返回值
##

一个布尔值。

Expand Down
7 changes: 4 additions & 3 deletions files/zh-cn/web/api/mouseevent/mouseevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ slug: Web/API/MouseEvent/MouseEvent

## 语法

```
event = new MouseEvent(typeArg, mouseEventInit);
```js-nolint
new MouseEvent(type)
new MouseEvent(type, options)
```

### 形参
### 参数

- _typeArg_
- : {{domxref("DOMString")}} 格式的事件名称。
Expand Down
8 changes: 1 addition & 7 deletions files/zh-cn/web/api/mouseevent/relatedtarget/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ slug: Web/API/MouseEvent/relatedTarget

如果事件没有次要目标,`relatedTarget` 将返回 `null`.

## 语法

```
var target = instanceOfMouseEvent.relatedTarget
```

### 返回值
##

{{domxref("EventTarget")}} 对象或者 `null`.

Expand Down
2 changes: 1 addition & 1 deletion files/zh-cn/web/api/mousescrollevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ slug: Web/API/MouseScrollEvent

## 方法概述

```
```webidl
void initMouseScrollEvent(
in DOMString typeArg,
in boolean canBubbleArg,
Expand Down
4 changes: 2 additions & 2 deletions files/zh-cn/web/api/mutationobserver/disconnect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ slug: Web/API/MutationObserver/disconnect

## 语法

```
mutationObserver.disconnect()
```js-nolint
disconnect()
```

### 参数
Expand Down
4 changes: 2 additions & 2 deletions files/zh-cn/web/api/mutationobserver/takerecords/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ slug: Web/API/MutationObserver/takeRecords

## 语法

```
mutationRecords = mutationObserver.takeRecords()
```js-nolint
takeRecords()
```

### 参数
Expand Down
6 changes: 3 additions & 3 deletions files/zh-cn/web/api/navigator/getusermedia/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ slug: Web/API/Navigator/getUserMedia

## 语法

```
navigator.getUserMedia ( constraints, successCallback, errorCallback );
```js-nolint
getUserMedia(constraints, successCallback, errorCallback)
```

### 参数
Expand Down Expand Up @@ -78,7 +78,7 @@ if (navigator.getUserMedia) {

在一个可以安装的 app(比如,Firefox OS app)中使用 getUserMedia(),你需要在你的 manifest 文件中指定一个或者多个以下条目:

```
```json
"permissions": {
"audio-capture": {
"description": "Required to capture audio using getUserMedia()"
Expand Down
4 changes: 2 additions & 2 deletions files/zh-cn/web/api/node/appendchild/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ slug: Web/API/Node/appendChild
## 语法

```
element.appendChild(aChild)
```js-nolint
appendChild(aChild)
```

### 参数
Expand Down
5 changes: 3 additions & 2 deletions files/zh-cn/web/api/node/clonenode/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ slug: Web/API/Node/cloneNode

## 语法

```
var dupNode = node.cloneNode(deep);
```js-nolint
cloneNode()
cloneNode(deep)
```

- `node`
Expand Down
4 changes: 2 additions & 2 deletions files/zh-cn/web/api/node/comparedocumentposition/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ slug: Web/API/Node/compareDocumentPosition

## 语法

```
compareMask = node.compareDocumentPosition( otherNode )
```js-nolint
compareDocumentPosition(otherNode)
```

### 参数
Expand Down
8 changes: 3 additions & 5 deletions files/zh-cn/web/api/node/haschildnodes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ slug: Web/API/Node/hasChildNodes

{{ApiRef}}

### 概述

**hasChildNodes**方法返回一个[布尔值](/zh-CN/docs/JavaScript/Reference/Global_Objects/Boolean),表明当前[节点](/zh-CN/docs/DOM/Node)是否包含有[子节点](/zh-CN/docs/DOM/Node.childNodes).

## 语法

```
element.hasChildNodes()
```js-nolint
hasChildNodes()
```

## 例子
## 示例

下面的例子演示了:如果 id 为 foo 的这个元素有子节点,则从 dom 树中删除它的第一个子节点。

Expand Down
9 changes: 0 additions & 9 deletions files/zh-cn/web/api/node/nodename/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ slug: Web/API/Node/nodeName

返回当前节点的节点名称

## 语法

```
var str = node.nodeName;
```

- `str` 是一个存储了当前节点的节点名称的字符串。
- `nodeName 是一个只读属性`.

## 附注

下表列出了所有类型的节点的`nodeName`属性的值。
Expand Down
9 changes: 1 addition & 8 deletions files/zh-cn/web/api/node/textcontent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ slug: Web/API/Node/textContent

> **备注:** `textContent` 和 {{domxref("HTMLElement.innerText")}} 容易混淆,但这两个属性在[重要方面有不同之处](/zh-CN/docs/Web/API/Node/textContent#与_innerText_的区别)
## 语法

```
let text = someNode.textContent;
someOtherNode.textContent = string;
```

### 返回值
##

一个字符串或 `null`.

Expand Down
10 changes: 5 additions & 5 deletions files/zh-cn/web/api/nodelist/entries/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ slug: Web/API/NodeList/entries

## 语法

```
list.entries();
```js-nolint
entries()
```

### 返回值

返回一个 {{jsxref("Iteration_protocols","iterator")}}.

## 例子
## 示例

```js
var node = document.createElement("div");
Expand All @@ -38,7 +38,7 @@ for (var entry of list.entries()) {

结果如下:

```
```plain
Array [ 0, <p> ]
Array [ 1, #text "hey" ]
Array [ 2, <span> ]
Expand All @@ -48,7 +48,7 @@ Array [ 2, <span> ]

{{Compat}}

## 相关链接
## 参见

- {{domxref("Node")}}
- {{domxref("NodeList")}}
7 changes: 4 additions & 3 deletions files/zh-cn/web/api/nodelist/foreach/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ slug: Web/API/NodeList/forEach

## 语法

```
someNodeList.forEach(callback[, thisArg]);
```js-nolint
forEach(callback)
forEach(callback, thisArg)
```

### 参数
Expand Down Expand Up @@ -54,7 +55,7 @@ list.forEach(function (currentValue, currentIndex, listObj) {

上述代码会产生以下结果:

```
```plain
[object HTMLParagraphElement], 0, myThisArg
[object Text], 1, myThisArg
[object HTMLSpanElement], 2, myThisArg
Expand Down
Loading