Skip to content

Commit 1205655

Browse files
committed
More fixes
1 parent dfeb171 commit 1205655

File tree

9 files changed

+979
-1060
lines changed

9 files changed

+979
-1060
lines changed

files/en-us/web/api/canvasrenderingcontext2d/arcto/index.md

Lines changed: 659 additions & 673 deletions
Large diffs are not rendered by default.

files/en-us/web/api/document_object_model/examples/index.md

Lines changed: 255 additions & 302 deletions
Large diffs are not rendered by default.

files/en-us/web/api/keyboardevent/altkey/index.md

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,28 @@ A boolean value.
1919
## Examples
2020

2121
```html
22-
<!doctype html>
23-
<html lang="en-US">
24-
<head>
25-
<meta charset="utf-8" />
26-
<meta name="viewport" content="width=device-width" />
27-
<title>altKey example</title>
28-
29-
<script>
30-
function showChar(e) {
31-
alert(
32-
"Key KeyDown: " +
33-
String.fromCharCode(e.charCode) +
34-
"\n" +
35-
"charCode: " +
36-
e.charCode +
37-
"\n" +
38-
"ALT key KeyDown: " +
39-
e.altKey +
40-
"\n",
41-
);
42-
}
43-
</script>
44-
</head>
45-
46-
<body onkeydown="showChar(event);">
47-
<p>
48-
Press any character key, with or without holding down the ALT key.<br />
49-
You can also use the SHIFT key together with the ALT key.
50-
</p>
51-
</body>
52-
</html>
22+
<p>
23+
Press any character key, with or without holding down the ALT key.<br />
24+
You can also use the SHIFT key together with the ALT key.
25+
</p>
26+
<pre id="output"></pre>
5327
```
5428

29+
```js
30+
const output = document.getElementById("output");
31+
32+
function showChar(e) {
33+
output.textContent = `Key KeyDown: ${String.fromCharCode(e.charCode)}
34+
charCode: ${e.charCode}
35+
ALT key KeyDown: ${e.altKey}
36+
`;
37+
}
38+
39+
document.addEventListener("keydown", showChar);
40+
```
41+
42+
{{EmbedLiveSample("examples", "", "400")}}
43+
5544
## Specifications
5645

5746
{{Specifications}}

files/en-us/web/api/keyboardevent/ctrlkey/index.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,28 @@ A boolean value.
1919
## Examples
2020

2121
```html
22-
<html lang="en">
23-
<head>
24-
<title>ctrlKey example</title>
25-
<script>
26-
function showChar(e) {
27-
alert(`Key Pressed: ${e.key}\nCTRL key pressed: ${e.ctrlKey}\n`);
28-
}
29-
</script>
30-
</head>
31-
<body onkeypress="showChar(event);">
32-
<p>
33-
Press any character key, with or without holding down the CTRL key.<br />
34-
You can also use the SHIFT key together with the CTRL key.
35-
</p>
36-
</body>
37-
</html>
22+
<p>
23+
Press any character key, with or without holding down the CTRL key.<br />
24+
You can also use the SHIFT key together with the CTRL key.
25+
</p>
26+
<pre id="output"></pre>
3827
```
3928

29+
```js
30+
const output = document.getElementById("output");
31+
32+
function showChar(e) {
33+
output.textContent = `Key KeyDown: ${String.fromCharCode(e.charCode)}
34+
charCode: ${e.charCode}
35+
CTRL key KeyDown: ${e.ctrlKey}
36+
`;
37+
}
38+
39+
document.addEventListener("keydown", showChar);
40+
```
41+
42+
{{EmbedLiveSample("examples", "", "400")}}
43+
4044
## Specifications
4145

4246
{{Specifications}}

files/en-us/web/api/keyboardevent/shiftkey/index.md

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,28 @@ A boolean value.
2121
## Examples
2222

2323
```html
24-
<html lang="en-US">
25-
<head>
26-
<meta charset="utf-8" />
27-
<meta name="viewport" content="width=device-width" />
28-
<title>shiftKey example</title>
29-
30-
<script>
31-
function showChar(e) {
32-
alert(
33-
"Key Pressed: " +
34-
String.fromCharCode(e.charCode) +
35-
"\n" +
36-
"charCode: " +
37-
e.charCode +
38-
"\n" +
39-
"SHIFT key pressed: " +
40-
e.shiftKey +
41-
"\n" +
42-
"ALT key pressed: " +
43-
e.altKey +
44-
"\n",
45-
);
46-
}
47-
</script>
48-
</head>
49-
50-
<body onkeypress="showChar(event);">
51-
<p>
52-
Press any character key, with or without holding down the SHIFT key.<br />
53-
You can also use the SHIFT key together with the ALT key.
54-
</p>
55-
</body>
56-
</html>
24+
<p>
25+
Press any character key, with or without holding down the SHIFT key.<br />
26+
You can also use the SHIFT key together with the ALT key.
27+
</p>
28+
<pre id="output"></pre>
5729
```
5830

31+
```js
32+
const output = document.getElementById("output");
33+
34+
function showChar(e) {
35+
output.textContent = `Key KeyDown: ${String.fromCharCode(e.charCode)}
36+
charCode: ${e.charCode}
37+
SHIFT key KeyDown: ${e.shiftKey}
38+
`;
39+
}
40+
41+
document.addEventListener("keydown", showChar);
42+
```
43+
44+
{{EmbedLiveSample("examples", "", "400")}}
45+
5946
## Specifications
6047

6148
{{Specifications}}

files/en-us/web/api/web_workers_api/using_web_workers/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ There is not an "official" way to embed the code of a worker within a web page,
660660
// In the past blob builder existed, but now we use Blob
661661
const blob = new Blob(
662662
Array.prototype.map.call(
663-
document.querySelectorAll("script[type='text\/js-worker']"),
663+
document.querySelectorAll("script[type='text/js-worker']"),
664664
(script) => script.textContent,
665665
),
666666
{ type: "text/javascript" },

files/en-us/web/css/@media/prefers-color-scheme/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ In this case, the parent element with a `color-scheme` CSS property is a `<div>`
124124
<script>
125125
for (let img of document.querySelectorAll("img")) {
126126
img.alt = "circle";
127-
img.src =
128-
"data:image/svg+xml;base64," +
129-
window.btoa(`
127+
img.src = `data:image/svg+xml;base64,${window.btoa(`
130128
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
131129
<style>
132130
:root { color: blue }
@@ -136,7 +134,7 @@ In this case, the parent element with a `color-scheme` CSS property is a `<div>`
136134
</style>
137135
<circle fill="currentColor" cx="16" cy="16" r="16"/>
138136
</svg>
139-
`);
137+
`)}`;
140138
}
141139
</script>
142140
```

files/en-us/web/javascript/reference/statements/import/with/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ In `index.html`:
117117
<meta charset="utf-8" />
118118
<script type="module">
119119
import data from "./data.json" with { type: "json" };
120+
120121
const p = document.createElement("p");
121122
p.textContent = `name: ${data.name}`;
122123
document.body.appendChild(p);

files/en-us/webassembly/guides/rust_to_wasm/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ Put the following content in the `index.html` file:
238238
<body>
239239
<script type="module">
240240
import init, { greet } from "./pkg/hello_wasm.js";
241+
241242
init().then(() => {
242243
greet("WebAssembly");
243244
});

0 commit comments

Comments
 (0)