Skip to content

Commit c4afb3c

Browse files
committed
Integrate proofreading for Chapter 13
1 parent 577bae0 commit c4afb3c

File tree

3 files changed

+37
-38
lines changed

3 files changed

+37
-38
lines changed

13_dom.txt

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
= The Document Object Model =
77

8-
(((drawing)))(((parsing)))When you open a web page in your browser, it
8+
(((drawing)))(((parsing)))When you open a web page in your browser, the browser
99
retrieves the page's ((HTML)) text and parses it, much like the way
1010
our parser from link:11_language.html#parsing[Chapter 11] parsed
1111
programs. The browser builds up a model of the document's
@@ -21,7 +21,7 @@ updated to reflect the changes.
2121

2222
You can imagine an ((HTML)) document as a nested set of ((box))es.
2323
Tags such as `<body>` and `</body>` enclose other ((tag))s, which in
24-
turn contain other tags, or ((text)). Here's the example document from
24+
turn contain other tags or ((text)). Here's the example document from
2525
the link:12_browser.html#browser[previous chapter]:
2626

2727
[sandbox="homepage"]
@@ -65,8 +65,8 @@ representing the `<html>` tag. It also provides the properties `head` and
6565
link:11_language.html#parsing[Chapter 11] for a moment. Their
6666
structures are strikingly similar to the structure of a browser's
6767
document. Each _((node))_ may refer to other nodes, _children_, which
68-
may have their own children. This shape is typical of nested
69-
structures where elements can contain subelements that are similar to
68+
in turn may have their own children. This shape is typical of nested
69+
structures where elements can contain sub-elements that are similar to
7070
themselves.
7171

7272
(((documentElement property)))We call a data structure a _((tree))_
@@ -101,7 +101,7 @@ has a `nodeType` property, which contains a numeric code that
101101
identifies the type of node. Regular elements have the value 1, which
102102
is also defined as the constant property `document.ELEMENT_NODE`. Text
103103
nodes, representing a section of text in the document, have the value
104-
3 (`document.TEXT_NODE`). Comments get the value 8
104+
3 (`document.TEXT_NODE`). Comments have the value 8
105105
(`document.COMMENT_NODE`).
106106

107107
So another way to visualize our document ((tree)) is as follows:
@@ -175,8 +175,8 @@ before or after the node itself. For a first child, `previousSibling`
175175
will be null, and for a last child, `nextSibling` will be null.
176176

177177
(((talksAbout function)))(((recursion)))(((nesting,of objects)))When
178-
dealing with a nested data structure like this, recursive functions
179-
are often useful. The following one scans a document for ((text node))s
178+
dealing with a nested data structure like this one, recursive functions
179+
are often useful. The following recursive function scans a document for ((text node))s
180180
containing a given string and returns `true` when it has found one:
181181

182182
[[talksAbout]]
@@ -435,7 +435,7 @@ attributes.
435435

436436
(((programming language)))(((syntax highlighting example)))As a simple
437437
example, we'll write a “syntax highlighter” that looks for `<pre>`
438-
tags (“preformatted”, used for code and similar plain text) with a
438+
tags (“preformatted”, used for code and similar plaintext) with a
439439
`data-language` attribute and crudely tries to highlight the
440440
((keyword))s for that language.
441441

@@ -587,7 +587,7 @@ the precise position of an element on the screen is the
587587
`getBoundingClientRect` method. It returns an object with `top`,
588588
`bottom`, `left`, and `right` properties, indicating the pixel
589589
positions of the sides of the element relative to the top left of the
590-
_screen_. If you want them relative to the whole document, you must
590+
screen. If you want them relative to the whole document, you must
591591
add the current scroll position, found under the global `pageXOffset`
592592
and `pageYOffset` variables.
593593

@@ -675,11 +675,11 @@ endif::book_target[]
675675
style attribute may contain one or more _((declaration))s_, which are
676676
a property (such as `color`) followed by a colon and a value (such as
677677
`green`). When there is more than one declaration, they must be
678-
separated by ((semicolon))s, as in “++color: red; border: none++”.
678+
separated by ((semicolon))s, as in `"color: red; border: none"`.
679679

680680
(((display (CSS))))(((layout)))There are a lot of aspects that can be
681-
influenced with styling. For example, the `display` property controls
682-
whether an element is displayed as a block or inline element.
681+
influenced by styling. For example, the `display` property controls
682+
whether an element is displayed as a block or an inline element.
683683

684684
[source,text/html]
685685
----
@@ -731,9 +731,9 @@ letters that follow them capitalized (`style.fontFamily`).
731731
== Cascading styles ==
732732

733733
indexsee:[Cascading Style Sheets,CSS]
734-
(((rule (CSS))))(((style (HTML tag))))The styling system for HTML is called ((CSS)),
734+
(((rule (CSS))))(((style (HTML tag))))The styling system for HTML is called ((CSS))
735735
for _Cascading Style Sheets_. A _((style sheet))_ is a set of
736-
rules for how to style elements in the document. It can be given
736+
rules for how to style elements in a document. It can be given
737737
inside a `<style>` tag.
738738

739739
[source,text/html]
@@ -748,7 +748,7 @@ inside a `<style>` tag.
748748
----
749749

750750
(((rule (CSS))))(((font-weight (CSS))))(((overlay)))The _((cascading))_ in the name
751-
refers to the fact that multiple such rules get combined to
751+
refers to the fact that multiple such rules are combined to
752752
produce the final style for an element. In the previous example, the
753753
default styling for `<strong>` tags, which gives them `font-weight:
754754
bold`, is overlaid by the rule in the `<style>` tag, which adds
@@ -766,7 +766,7 @@ precedence and always win.
766766
to target things other than ((tag)) names in CSS rules. A rule for
767767
`.abc` applies to all elements with `"abc"` in their class attributes.
768768
A rule for `#xyz` applies to the element with an `id` attribute of
769-
`"xyz"` (which should be unique, within the document).
769+
`"xyz"` (which should be unique within the document).
770770

771771
[source,text/css]
772772
----
@@ -850,20 +850,19 @@ element or null if no elements match.
850850
[[animation]]
851851
== Positioning and animating ==
852852

853-
(((position (CSS))))The `position` style property influences layout in
854-
a powerful way.
855-
856-
(((relative positioning)))(((top (CSS))))(((left (CSS))))(((absolute
857-
positioning)))By default it has a value of `static`, meaning the
858-
element sits in its normal place in the document. When it is set to
859-
`relative`, the element still takes up space in the document, but now
860-
the `top` and `left` style properties can be used to move it relative
861-
to its normal place. When `position` is set to `absolute`, the element
862-
is removed from the normal document flow—that is, it no longer takes
863-
up space and may overlap with other elements. Also, its `top` and `left`
864-
properties can be used to absolutely position it relative to the top-left
865-
corner of the nearest enclosing element whose `position` property
866-
isn't `static`, or relative to the document if no such enclosing element exists.
853+
(((position (CSS))))(((relative positioning)))(((top (CSS))))(((left
854+
(CSS))))(((absolute positioning)))The `position` style property
855+
influences layout in a powerful way. By default it has a value of
856+
`static`, meaning the element sits in its normal place in the
857+
document. When it is set to `relative`, the element still takes up
858+
space in the document, but now the `top` and `left` style properties
859+
can be used to move it relative to its normal place. When `position`
860+
is set to `absolute`, the element is removed from the normal document
861+
flow—that is, it no longer takes up space and may overlap with other
862+
elements. Also, its `top` and `left` properties can be used to
863+
absolutely position it relative to the top-left corner of the nearest
864+
enclosing element whose `position` property isn't `static`, or
865+
relative to the document if no such enclosing element exists.
867866

868867
We can use this to create an ((animation)). The following document
869868
displays a picture of a cat that floats around in an ((ellipse)):
@@ -939,9 +938,9 @@ finding points that lie on a circle around point (0,0) with a radius
939938
of one unit. Both functions interpret their argument as the position
940939
on this circle, with zero denoting the point on the far right of the
941940
circle, going clockwise until 2π (about 6.28) has taken us around the
942-
whole circle. `Math.cos` tells you the x coordinate of the point that
941+
whole circle. `Math.cos` tells you the x-coordinate of the point that
943942
corresponds to the given position around the circle, while `Math.sin`
944-
yields the y coordinate. Positions (or angles) greater than 2π or less than
943+
yields the y-coordinate. Positions (or angles) greater than 2π or less than
945944
0 are valid—the rotation repeats so that _a_+2π refers to the same
946945
((angle)) as _a_.
947946

@@ -963,7 +962,7 @@ we have to append `"px"` to the number to tell the browser we are
963962
counting in ((pixel))s (as opposed to centimeters, “ems”, or other
964963
units). This is easy to forget. Using numbers without units will
965964
result in your style being ignored—unless the number is 0, which
966-
always means the same, regardless of its unit.
965+
always means the same thing, regardless of its unit.
967966

968967
== Summary ==
969968

@@ -989,7 +988,7 @@ element's style directly through its `style` property.
989988
[[exercise_table]]
990989
=== Build a table ===
991990

992-
(((table (HTML tag))))We built plain-text ((table))s in
991+
(((table (HTML tag))))We built plaintext ((table))s in
993992
link:06_object.html#tables[Chapter 6]. HTML makes laying out tables
994993
quite a bit easier. An ((HTML)) table is built with the following tag
995994
structure:

15_game.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Level.prototype.isFinished = function() {
222222
[[vector]]
223223
(((Vector type)))(((coordinates)))To store the position and size of an
224224
actor, we will return to our trusty `Vector` type, which groups an x
225-
coordinate and a y coordinate into an object.
225+
coordinate and a y-coordinate into an object.
226226

227227
// include_code
228228

@@ -337,7 +337,7 @@ Coin.prototype.type = "coin";
337337
(((Math.random function)))(((random number)))(((Math.sin
338338
function)))(((sine)))(((wave)))In
339339
link:13_dom.html#sin_cos[Chapter 13], we saw that `Math.sin` gives us
340-
the y coordinate of a point on a circle. That coordinate goes back and
340+
the y-coordinate of a point on a circle. That coordinate goes back and
341341
forth in a smooth wave form as we move along the circle, which makes
342342
the sine function useful for modeling a wavy motion.
343343

19_paint.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,8 @@ event handler.
751751
function)))When you have two corners of the rectangle, you must
752752
somehow translate these into the arguments that `fillRect` expects:
753753
the top-left corner, width, and height of the rectangle. `Math.min`
754-
can be used to find the leftmost x coordinate and topmost y
755-
coordinate. To get the width or height, you can call `Math.abs` (the
754+
can be used to find the leftmost x-coordinate and topmost
755+
y-coordinate. To get the width or height, you can call `Math.abs` (the
756756
absolute value) on the difference between two sides.
757757

758758
(((coordinates)))Showing the rectangle during the mouse drag requires

0 commit comments

Comments
 (0)