Skip to content

Commit

Permalink
ja: Format /web/api using Prettier (part 4)
Browse files Browse the repository at this point in the history
  • Loading branch information
queengooborg committed Jul 28, 2023
1 parent 881e54e commit 8607f16
Show file tree
Hide file tree
Showing 100 changed files with 859 additions and 746 deletions.
8 changes: 4 additions & 4 deletions files/ja/web/api/dompointreadonly/frompoint_static/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ original_slug: Web/API/DOMPointReadOnly/fromPoint
## 構文

```js
fromPoint(sourcePoint)
fromPoint(sourcePoint);
```

### 引数
Expand Down Expand Up @@ -42,17 +42,17 @@ fromPoint(sourcePoint)
このサンプルでは、 {{domxref("DOMPointReadOnly.x", "x")}} と {{domxref("DOMPointReadOnly.y", "y")}} に使用する値を含むインラインオブジェクトを指定し、二次元点を作成しています。 `z``w` プロパティは既定値(それぞれ `0``1`)のままにしておくことが可能です。

```js
const point2D = DOMPointReadOnly.fromPoint({x: 25, y: 25})
const point2D = DOMPointReadOnly.fromPoint({ x: 25, y: 25 });
```

### 既存の点を使用して三次元の点を作成します。

この例では、 {{domxref("DOMPoint")}} を用いて、 {{domxref("DOMPoint.DOMPoint", "new DOMPoint()")}} 型の点 `origPoint` を作成しています。そして、その点は `fromPoint()` の入力として使用され、新しい点 `newPoint` を作成します。

```js
const origPoint = new DOMPoint(25, 25, 100, 0.5)
const origPoint = new DOMPoint(25, 25, 100, 0.5);

const newPoint = DOMPointReadOnly.fromPoint(origPoint)
const newPoint = DOMPointReadOnly.fromPoint(origPoint);
```

## 仕様書
Expand Down
2 changes: 1 addition & 1 deletion files/ja/web/api/dompointreadonly/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const point3DPerspective = new DOMPointReadOnly(100, 100, 100, 1.0);
もう一つの選択肢は、静的な {{domxref("DOMPointReadOnly.fromPoint()")}} メソッドを使用する方法です。

```js
const point = DOMPointReadOnly.fromPoint({x: 100, y: 100, z: 50, w: 1.0});
const point = DOMPointReadOnly.fromPoint({ x: 100, y: 100, z: 50, w: 1.0 });
```

## コンストラクター
Expand Down
2 changes: 1 addition & 1 deletion files/ja/web/api/dompointreadonly/tojson/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ slug: Web/API/DOMPointReadOnly/toJSON
## 構文

```js
toJSON()
toJSON();
```

### 引数
Expand Down
4 changes: 2 additions & 2 deletions files/ja/web/api/domrect/fromrect_static/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ original_slug: Web/API/DOMRect/fromRect
## 構文

```js
fromRect()
fromRect(rectangle)
fromRect();
fromRect(rectangle);
```

### 引数
Expand Down
5 changes: 3 additions & 2 deletions files/ja/web/api/domrectreadonly/domrectreadonly/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ slug: Web/API/DOMRectReadOnly/DOMRectReadOnly
## 構文

```js
new DOMRectReadOnly(x, y, width, height)
new DOMRectReadOnly(x, y, width, height);
```

### 引数

- _x_
- : `DOMRectReadOnly` の原点の `x` 座標です。
- _y_

- : `DOMRectReadOnly` の原点の `y` 座標です。

- _width_
Expand All @@ -30,7 +31,7 @@ new DOMRectReadOnly(x, y, width, height)
新しい `DOMPoint` を作成するには、次のようなコード行を実行します。

```js
const myDOMRect = new DOMRectReadOnly(0, 0, 100, 100)
const myDOMRect = new DOMRectReadOnly(0, 0, 100, 100);
// 'myDOMRect' をコンソールで実行すると、次の行が返ります。
// DOMRect { x: 0, y: 0, width: 100, height: 100, top: 0, right: 100, bottom: 100, left: 0 }
```
Expand Down
4 changes: 2 additions & 2 deletions files/ja/web/api/domrectreadonly/fromrect_static/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ original_slug: Web/API/DOMRectReadOnly/fromRect
## 構文

```js
fromRect()
fromRect(rectangle)
fromRect();
fromRect(rectangle);
```

### 引数
Expand Down
14 changes: 9 additions & 5 deletions files/ja/web/api/dragevent/datatransfer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ slug: Web/API/DragEvent/dataTransfer

```js
function processData(d) {
// データを処理...
// データを処理...
}

dragTarget.addEventListener("dragend", function(ev) {
// ドラッグ&ドロップのデータ処理を呼び出す
if (ev.dataTransfer !== null) processData(ev.dataTransfer);
}, false);
dragTarget.addEventListener(
"dragend",
function (ev) {
// ドラッグ&ドロップのデータ処理を呼び出す
if (ev.dataTransfer !== null) processData(ev.dataTransfer);
},
false,
);
```

## 仕様書
Expand Down
5 changes: 3 additions & 2 deletions files/ja/web/api/dragevent/dragevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ slug: Web/API/DragEvent/DragEvent
## 構文

```js
new DragEvent(type)
new DragEvent(type, dragEventInit)
new DragEvent(type);
new DragEvent(type, dragEventInit);
```

### 引数

- `type`

- : イベント名を表す文字列です([DragEvent のイベントの種類](/ja/docs/Web/API/DragEvent#イベントの種類)を参照)。

- `dragEventInit` {{optional_inline}}
Expand Down
1 change: 1 addition & 0 deletions files/ja/web/api/eckeygenparams/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ l10n:
- `name`
- : 文字列。使用したいアルゴリズムにより、`ECDSA` または `ECDH` に設定するべきです。
- `namedCurve`

- : 使用する楕円曲線の名前を表す文字列です。以下の [NIST](https://www.nist.gov/) によって承認された曲線の名前のうちいずれかを指定できます。

- `P-256`
Expand Down
2 changes: 1 addition & 1 deletion files/ja/web/api/element/append/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ console.log(div.childNodes); // NodeList [ <p> ]
let div = document.createElement("div");
div.append("Some text");

console.log(div.textContent) // "Some text"
console.log(div.textContent); // "Some text"
```

### 要素とテキストの追加
Expand Down
34 changes: 19 additions & 15 deletions files/ja/web/api/element/compositionend_event/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Element: compositionend イベント'
title: "Element: compositionend イベント"
slug: Web/API/Element/compositionend_event
---

Expand Down Expand Up @@ -35,7 +35,7 @@ slug: Web/API/Element/compositionend_event
```js
const inputElement = document.querySelector('input[type="text"]');

inputElement.addEventListener('compositionend', (event) => {
inputElement.addEventListener("compositionend", (event) => {
console.log(`generated characters were: ${event.data}`);
});
```
Expand All @@ -46,8 +46,11 @@ inputElement.addEventListener('compositionend', (event) => {

```html
<div class="control">
<label for="name">On macOS, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label>
<input type="text" id="example" name="example">
<label for="name"
>On macOS, click in the textbox below,<br />
then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label
>
<input type="text" id="example" name="example" />
</div>

<div class="event-log">
Expand All @@ -59,7 +62,7 @@ inputElement.addEventListener('compositionend', (event) => {

```css hidden
body {
padding: .2rem;
padding: 0.2rem;
display: grid;
grid-template-areas: "control log";
}
Expand All @@ -76,12 +79,13 @@ body {
resize: none;
}

label, button {
label,
button {
display: block;
}

input[type="text"] {
margin: .5rem 0;
margin: 0.5rem 0;
}

kbd {
Expand All @@ -95,20 +99,20 @@ kbd {

```js
const inputElement = document.querySelector('input[type="text"]');
const log = document.querySelector('.event-log-contents');
const clearLog = document.querySelector('.clear-log');
const log = document.querySelector(".event-log-contents");
const clearLog = document.querySelector(".clear-log");

clearLog.addEventListener('click', () => {
log.textContent = '';
clearLog.addEventListener("click", () => {
log.textContent = "";
});

function handleEvent(event) {
log.textContent = log.textContent + `${event.type}: ${event.data}\n`;
log.textContent = log.textContent + `${event.type}: ${event.data}\n`;
}

inputElement.addEventListener('compositionstart', handleEvent);
inputElement.addEventListener('compositionupdate', handleEvent);
inputElement.addEventListener('compositionend', handleEvent);
inputElement.addEventListener("compositionstart", handleEvent);
inputElement.addEventListener("compositionupdate", handleEvent);
inputElement.addEventListener("compositionend", handleEvent);
```

#### 結果
Expand Down
34 changes: 19 additions & 15 deletions files/ja/web/api/element/compositionstart_event/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Element: compositionstart イベント'
title: "Element: compositionstart イベント"
slug: Web/API/Element/compositionstart_event
---

Expand Down Expand Up @@ -35,7 +35,7 @@ slug: Web/API/Element/compositionstart_event
```js
const inputElement = document.querySelector('input[type="text"]');

inputElement.addEventListener('compositionstart', (event) => {
inputElement.addEventListener("compositionstart", (event) => {
console.log(`generated characters were: ${event.data}`);
});
```
Expand All @@ -46,8 +46,11 @@ inputElement.addEventListener('compositionstart', (event) => {

```html
<div class="control">
<label for="name">On macOS, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label>
<input type="text" id="example" name="example">
<label for="name"
>On macOS, click in the textbox below,<br />
then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label
>
<input type="text" id="example" name="example" />
</div>

<div class="event-log">
Expand All @@ -59,7 +62,7 @@ inputElement.addEventListener('compositionstart', (event) => {

```css hidden
body {
padding: .2rem;
padding: 0.2rem;
display: grid;
grid-template-areas: "control log";
}
Expand All @@ -76,12 +79,13 @@ body {
resize: none;
}

label, button {
label,
button {
display: block;
}

input[type="text"] {
margin: .5rem 0;
margin: 0.5rem 0;
}

kbd {
Expand All @@ -95,20 +99,20 @@ kbd {

```js
const inputElement = document.querySelector('input[type="text"]');
const log = document.querySelector('.event-log-contents');
const clearLog = document.querySelector('.clear-log');
const log = document.querySelector(".event-log-contents");
const clearLog = document.querySelector(".clear-log");

clearLog.addEventListener('click', () => {
log.textContent = '';
clearLog.addEventListener("click", () => {
log.textContent = "";
});

function handleEvent(event) {
log.textContent = log.textContent + `${event.type}: ${event.data}\n`;
log.textContent = log.textContent + `${event.type}: ${event.data}\n`;
}

inputElement.addEventListener('compositionstart', handleEvent);
inputElement.addEventListener('compositionupdate', handleEvent);
inputElement.addEventListener('compositionend', handleEvent);
inputElement.addEventListener("compositionstart", handleEvent);
inputElement.addEventListener("compositionupdate", handleEvent);
inputElement.addEventListener("compositionend", handleEvent);
```

#### 結果
Expand Down
Loading

0 comments on commit 8607f16

Please sign in to comment.