Skip to content

Commit c1ad6ae

Browse files
committed
Integrate editing for Chapter 18
1 parent 91508db commit c1ad6ae

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

09_regexp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ When creating the `\b` ((boundary)) markers, we have to use two
836836
backslashes because we are writing them in a normal string, not a
837837
slash-enclosed regular expression. The second argument to the `RegExp`
838838
constructor contains the options for the regular expression—in this
839-
case, `"gi"` for global and case-insensitive.
839+
case, `"gi"` for global and case insensitive.
840840

841841
But what if the name is `"dea+hl[]rd"` because our user is a ((nerd))y
842842
teenager? That would result in a nonsensical regular expression that
@@ -1223,7 +1223,7 @@ starting position of the match. Their `replace` method can replace
12231223
matches of a pattern with a replacement string or function.
12241224

12251225
Regular expressions can have options, which are written after the
1226-
closing slash. The `i` option makes the match case-insensitive. The
1226+
closing slash. The `i` option makes the match case insensitive. The
12271227
`g` option makes the expression _global_, which, among other things,
12281228
causes the `replace` method to replace all instances instead of just
12291229
the first. The `y` option makes it sticky, which means that it will
@@ -1421,7 +1421,7 @@ digits _or_ a dot followed by one or more digits.
14211421

14221422
{{index exponent, "case sensitivity", ["regular expression", flags]}}
14231423

1424-
Finally, to make the _e_ case-insensitive, either add an `i` option to
1424+
Finally, to make the _e_ case insensitive, either add an `i` option to
14251425
the regular expression or use `[eE]`.
14261426

14271427
hint}}

18_http.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ it to `DELETE` its main page, it'll probably refuse.
7474

7575
{{index [path, URL], GitHub}}
7676

77-
The part after the ((method)) name is the path of the ((resource)) the
77+
The part after the ((method)) name is the path of the _((resource))_ the
7878
request applies to. In the simplest case, a resource is simply a
7979
((file)) on the ((server)), but the protocol doesn't require it to be.
8080
A resource may be anything that can be transferred _as if_ it is a
@@ -89,7 +89,7 @@ After the resource path, the first line of the request mentions
8989
is using.
9090

9191
In practice, many sites use HTTP version 2, which supports the same
92-
concepts as version 1.1, but is a lot more complicated so that it can
92+
concepts as version 1.1 but is a lot more complicated so that it can
9393
be faster. Browsers will automatically switch to the appropriate
9494
protocol version when talking to a given server, and the outcome of a
9595
request is the same regardless which version is used. Because version
@@ -230,7 +230,7 @@ console.log(decodeURIComponent("Yes%3F"));
230230
If we change the `method` attribute of the HTML form in the example we
231231
saw earlier to `POST`, the ((HTTP)) request made to submit the
232232
((form)) will use the `POST` method and put the ((query string)) in
233-
body of the request, rather than adding it to the URL.
233+
the body of the request, rather than adding it to the URL.
234234

235235
```{lang: http}
236236
POST /example/message.html HTTP/1.1
@@ -275,21 +275,21 @@ fetch("example/data.txt").then(response => {
275275
Calling `fetch` returns a promise that resolves to a `Response` object
276276
holding information about the server's response, such as its status
277277
code and its headers. The headers are wrapped in a `Map`-like object
278-
that treats its keys (the header names) as case-insensitive, because
278+
that treats its keys (the header names) as case insensitive, because
279279
header names are not supposed to be case sensitive. This means that
280280
`headers.get("Content-Type")` and `headers.get("content-TYPE")` will
281281
return the same value.
282282

283283
Note that the promise returned by `fetch` resolves successfully even
284284
if the server responded with an error code. It _might_ also be
285-
rejected, if there is a network error or the ((server)) that the
285+
rejected, if there is a network error or if the ((server)) that the
286286
request is addressed to can't be found.
287287

288288
{{index [path, URL], "relative URL"}}
289289

290290
The first argument to `fetch` is the URL that should be requested.
291291
When that ((URL)) doesn't start with a protocol name (such as _http:_)
292-
it is treated as relative, which means that it is interpreted relative
292+
it is treated as _relative_, which means it is interpreted relative
293293
to the current document. When it starts with a slash (/), it replaces
294294
the current path, which is the part after the server name. When it
295295
does not, the part of the current path up to and including its last
@@ -317,7 +317,7 @@ rejects if it's not valid JSON.
317317

318318
{{index "GET method", "body (HTTP)", "DELETE method", "method property"}}
319319

320-
By default, `fetch` uses the `GET` method to make its request, and
320+
By default, `fetch` uses the `GET` method to make its request and
321321
does not include a request body. You can configure it differently by
322322
passing an object with extra options as a second argument. For
323323
example, this request tries to delete `example/data.txt`.
@@ -374,7 +374,7 @@ _mybank.com_).
374374

375375
{{index "Access-Control-Allow-Origin header", "cross-domain request"}}
376376

377-
This can be an annoying problem when building systems that wants to
377+
This can be an annoying problem when building systems that want to
378378
access several domains for legitimate reasons. Fortunately,
379379
((server))s can include a ((header)) like this in their ((response))
380380
to explicitly indicate to the browser that it is okay for the request
@@ -430,7 +430,7 @@ server interface around.
430430

431431
Data traveling over the Internet tends to follow a long, dangerous
432432
road. To get to its destination, it must hop through anything from
433-
coffee-shop Wi-Fi to ((network))s controlled by various companies and
433+
coffee-shop Wi-Fi hotspots to ((network))s controlled by various companies and
434434
states. At any point along its route it may be inspected or even
435435
modified.
436436

@@ -445,16 +445,16 @@ to via your bank's website, plain HTTP is not good enough.
445445

446446
{{indexsee "Secure HTTP", HTTPS}}
447447

448-
The secure ((HTTP)) protocol, whose ((URL))s start with _https://_,
448+
The secure ((HTTP)) protocol, used for ((URL))s start with _https://_,
449449
wraps HTTP traffic in a way that makes it harder to read and tamper
450450
with. Before exchanging data, the client verifies that the server is
451-
who it claims to be, by asking it to prove that it has a cryptographic
451+
who it claims to be by asking it to prove that it has a cryptographic
452452
((certificate)) issued by a certificate authority that the ((browser))
453453
recognizes. Next, all data going over the ((connection)) is encrypted
454454
in a way that should prevent eavesdropping and tampering.
455455

456-
Thus, when it works right, ((HTTPS)) prevents both the someone
457-
impersonating the website you were trying to talk to and the someone
456+
Thus, when it works right, ((HTTPS)) prevents other people from
457+
impersonating the website you are trying to talk to and from
458458
snooping on your communication. It is not perfect, and there have been
459459
various incidents where HTTPS failed because of forged or stolen
460460
certificates and broken software, but it is a _lot_ safer than plain
@@ -564,7 +564,7 @@ predefined options.
564564

565565
Such a field looks like this:
566566

567-
{{figure {url: "img/form_select.png", alt: "A select field",width: "4cm"}}}
567+
{{figure {url: "img/form_select.png", alt: "A select field", width: "4cm"}}}
568568

569569
if}}
570570

@@ -636,7 +636,7 @@ the OK button, rather than going through the help link first:
636636
{{index "tabindex attribute"}}
637637

638638
By default, most types of HTML elements cannot be focused. But you can
639-
add a `tabindex` attribute to any element, which will make it
639+
add a `tabindex` attribute to any element that will make it
640640
focusable. A `tabindex` of -1 makes tabbing skip over an element, even
641641
if it is normally focusable.
642642

@@ -665,8 +665,8 @@ if}}
665665
{{index "user experience", "asynchronous programming"}}
666666

667667
When a program is
668-
in the process of handling an action caused by some ((button)) or other control,
669-
which might require communication with the server and thus take a
668+
in the process of handling an action caused by some ((button)) or other control
669+
that might require communication with the server and thus take a
670670
while, it can be a good idea to
671671
disable the control until the action finishes. That way, when the user
672672
gets impatient and clicks it again, they don't accidentally repeat
@@ -1104,7 +1104,7 @@ prevents the feature from eating up too much space.
11041104
{{index "localStorage object", "note-taking example", "select (HTML tag)", "button (HTML tag)", "textarea (HTML tag)"}}
11051105

11061106
The following code implements a crude note-taking application. It
1107-
keeps a set of named notes, and allows the user to edit notes and
1107+
keeps a set of named notes and allows the user to edit notes and
11081108
create new ones.
11091109

11101110
```{lang: "text/html", startCode: true}
@@ -1165,19 +1165,19 @@ exist from `localStorage` will yield `null`. Passing `null` to
11651165
Thus, the `||` operator can be used to provide a default value in a
11661166
situation like this.
11671167

1168-
The `setState` method makes sure the DOM is showing a given state, and
1168+
The `setState` method makes sure the DOM is showing a given state and
11691169
stores the new state to `localStorage`. Event handlers call this
11701170
function to move to a new state.
11711171

11721172
{{index "Object.assign function", object, property, "computed property"}}
11731173

11741174
The use of `Object.assign` in the example is intended to create a new
11751175
object that is a clone of the old `state.notes`, but with one property
1176-
added or overwritten. `Object.assign` takes its first argument, and
1176+
added or overwritten. `Object.assign` takes its first argument and
11771177
adds all properties from any further arguments to it. Thus, giving it
11781178
an empty object will cause it to fill a fresh object. The ((square
11791179
brackets)) notation in the third argument is used to create a property
1180-
whose names is based on some dynamic value.
1180+
whose name is based on some dynamic value.
11811181

11821182
{{index "sessionStorage object"}}
11831183

@@ -1229,7 +1229,7 @@ file picker field, the `FileReader` interface can be used to access
12291229
the content of this file from a JavaScript program.
12301230

12311231
The `localStorage` and `sessionStorage` objects can be used to save
1232-
information in a way that survives page reloads. The first saves the
1232+
information in a way that survives page reloads. The first object saves the
12331233
data forever (or until the user decides to clear it), and the second
12341234
saves it until the browser is closed.
12351235

@@ -1239,7 +1239,7 @@ saves it until the browser is closed.
12391239

12401240
{{index "Accept header", "media type", "document format", "content negotiation (exercise)"}}
12411241

1242-
One of the things that HTTP can do is called _content negotiation_.
1242+
One of the things HTTP can do is called _content negotiation_.
12431243
The `Accept` request header is used to tell the server what type of
12441244
document the client would like to get. Many servers ignore this
12451245
header, but when a server knows of various ways to encode a resource,
@@ -1295,7 +1295,7 @@ JavaScript code.
12951295

12961296
{{index "textarea (HTML tag)", "button (HTML tag)", "Function constructor", "error message"}}
12971297

1298-
Put a button next to a `<textarea>` field, which, when pressed, uses
1298+
Put a button next to a `<textarea>` field that, when pressed, uses
12991299
the `Function` constructor we saw in [Chapter ?](modules#eval) to wrap
13001300
the text in a function and call it. Convert the return value of the
13011301
function, or any error it raises, to a string and display it below the
@@ -1327,7 +1327,7 @@ property of the text field and call `Function` on it.
13271327
{{index "try keyword", "exception handling"}}
13281328

13291329
Make sure you wrap both the call to `Function` and the call to its
1330-
result in a `try` block so that you can catch exceptions that it
1330+
result in a `try` block so you can catch the exceptions it
13311331
produces. In this case, we really don't know what type of exception we
13321332
are looking for, so catch everything.
13331333

@@ -1346,7 +1346,7 @@ hint}}
13461346
{{index "game of life (exercise)", "artificial life", "Conway's Game of Life"}}
13471347

13481348
Conway's Game of Life is a simple ((simulation)) that creates
1349-
artificial "life" on a ((grid)), each cell of which is either live or
1349+
artificial "life" on a ((grid)), each cell of which is either alive or
13501350
not. Each ((generation)) (turn), the following rules are applied:
13511351

13521352
* Any live ((cell)) with fewer than two or more than three live
@@ -1357,7 +1357,7 @@ not. Each ((generation)) (turn), the following rules are applied:
13571357

13581358
* Any dead cell with exactly three live neighbors becomes a live cell.
13591359

1360-
A neighbor is defined as any adjacent cell, including diagonally
1360+
A _neighbor_ is defined as any adjacent cell, including diagonally
13611361
adjacent ones.
13621362

13631363
{{index "pure function"}}
@@ -1407,7 +1407,7 @@ center, whose neighbors we are counting.
14071407

14081408
{{index "event handling", "change event"}}
14091409

1410-
Making changes to ((checkbox))es take effect on the next generation
1410+
Ensuring that changes to ((checkbox))es take effect on the next generation
14111411
can be done in two ways. An event handler could notice these changes
14121412
and update the current grid to reflect them, or you could generate a
14131413
fresh grid from the values in the checkboxes before computing the next

21_skillsharing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ SkillShareServer.prototype.talkResponse = function() {
577577

578578
The handler itself needs to look at the request headers to see whether
579579
`If-None-Match` and `Prefer` headers are present. Node stores headers,
580-
whose names are specified to be case-insensitive, under their
580+
whose names are specified to be case insensitive, under their
581581
lowercase names.
582582

583583
```{includeCode: ">code/skillsharing/skillsharing_server.js"}

0 commit comments

Comments
 (0)