Skip to content

Commit 76016c0

Browse files
committed
Add index terms to Chapter 13
1 parent f2f3efd commit 76016c0

8 files changed

Lines changed: 532 additions & 452 deletions

File tree

04_data.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,16 +1039,17 @@ Many languages will stop you, or at least warn you, when you are
10391039
defining a variable with a name that is already taken. JavaScript does
10401040
neither, so be careful.
10411041

1042-
(((trigonometry)))(((Math.cos function)))(((Math.sin
1043-
function)))(((Math.tan function)))(((Math.acos function)))(((Math.asin
1042+
(((Math.cos function)))(((Math.sin function)))(((Math.tan
1043+
function)))(((Math.acos function)))(((Math.asin
10441044
function)))(((Math.atan function)))(((Math.PI
10451045
constant)))(((cosine)))(((sine)))(((tangent)))(((PI constant)))Back to
1046-
the `Math` object. If you need to do trigonometry, `Math` can help. It
1047-
contains `cos` (cosine), `sin` (sine), and `tan` (tangent), as well as
1048-
their inverse functions, `acos`, `asin`, and `atan`. The number π
1049-
(pi)—or at least the closest approximation that fits in a JavaScript
1050-
number—is available as `Math.PI`. (There is an old programming
1051-
tradition of writing the names of ((constant)) values in all caps.)
1046+
the `Math` object. If you need to do ((trigonometry)), `Math` can
1047+
help. It contains `cos` (cosine), `sin` (sine), and `tan` (tangent),
1048+
as well as their inverse functions, `acos`, `asin`, and `atan`. The
1049+
number π (pi)—or at least the closest approximation that fits in a
1050+
JavaScript number—is available as `Math.PI`. (There is an old
1051+
programming tradition of writing the names of ((constant)) values in
1052+
all caps.)
10521053

10531054
// test: no
10541055

05_higher_order.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ mostly full of Flemish ((farmer))s. For my amusement, I extracted the
382382
information on my direct ancestors, and put it into a
383383
computer-readable format.
384384

385-
(((JSON)))The file I created looks something like this:
385+
(((data format)))(((JSON)))The file I created looks something like
386+
this:
386387

387388
[source,application/json]
388389
----

06_object.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,9 +828,9 @@ objects in the data set appear as normal cells—we extract them by
828828
mapping over the `keys` array, so that we are sure that the order of
829829
the cells is the same in every row.
830830

831-
The resulting table resembles the example shown before, except that it
832-
does not right-align the numbers in the `height` colomn. We will get
833-
to that in a moment.
831+
(((right-aligning)))The resulting table resembles the example shown
832+
before, except that it does not right-align the numbers in the
833+
`height` colomn. We will get to that in a moment.
834834

835835
== Getters and setters ==
836836

09_regexp.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ our progress through the flow chart would look like this:
529529
so we go through the last box and have successfully matched this
530530
string.
531531

532-
((regular
533-
expression,matching))(((matching,algorithm)))(((searching)))Conceptually,
532+
(((regular
533+
expression,matching)))(((matching,algorithm)))(((searching)))Conceptually,
534534
a regular expression engine looks for a match in a string as follows:
535535
it starts at the start of the string and tries a match there. In this
536536
case, there _is_ a word boundary there, so it'd get past the first

13_dom.txt

Lines changed: 499 additions & 421 deletions
Large diffs are not rendered by default.

15_game.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ the game. It would also be possible to directly assign to the
401401
elements’ `style` property when we create them, but that would produce
402402
more verbose programs.
403403

404-
(((class (CSS))))The following helper function provides a short way to
404+
(((class attribute)))The following helper function provides a short way to
405405
create an element and give it a class.
406406

407407
// include_code
@@ -527,7 +527,7 @@ DOMDisplay.prototype.drawActors = function() {
527527
};
528528
----
529529

530-
(((position (CSS))))(((class (CSS))))Giving an element more than one
530+
(((position (CSS))))(((class attribute)))Giving an element more than one
531531
class is done by separating the class names with spaces. In the
532532
((CSS)) code shown next, the `actor` class gives the actors their
533533
absolute position. Their type name is used as an extra class to give
@@ -565,7 +565,7 @@ DOMDisplay.prototype.drawFrame = function() {
565565
};
566566
----
567567

568-
(((level)))(((class (CSS))))(((style sheet)))By adding the level's
568+
(((level)))(((class attribute)))(((style sheet)))By adding the level's
569569
current status as a class name to the wrapper, we can style the player
570570
actor slightly differently when the game is won or lost, by adding a
571571
((CSS)) rule that only takes effect when the player has an ((ancestor

19_paint.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ handlers, or have to be touched by the script in some other way. Thus,
7272
our script would have to make lots of `querySelector` (or similar)
7373
calls in order to find the DOM elements that it needs to act on.
7474

75-
(((readability)))(((verbosity)))(((createElement method)))It would be
76-
nice if the DOM structure for each part of our interface is defined
77-
close to the JavaScript code that drives it. Thus, I've chosen to do
78-
all creation of DOM nodes in JavaScript. As we saw in
79-
link:13_dom.html#standard[Chapter 13], the built-in interface for
80-
building up a DOM structure is horrendously verbose. If we are going
81-
to do a lot of DOM construction, we need a helper function.
75+
(((DOM,construction)))(((readability)))(((verbosity)))(((createElement
76+
method)))It would be nice if the DOM structure for each part of our
77+
interface is defined close to the JavaScript code that drives it.
78+
Thus, I've chosen to do all creation of DOM nodes in JavaScript. As we
79+
saw in link:13_dom.html#standard[Chapter 13], the built-in interface
80+
for building up a DOM structure is horrendously verbose. If we are
81+
going to do a lot of DOM construction, we need a helper function.
8282

8383
(((elt function)))This function below is an extended version of the
8484
`elt` function from link:13_dom.html#elt[Chapter 13]. It creates an
@@ -146,7 +146,7 @@ canvas—it contains the current picture as well as the selected color
146146
(in its `fillStyle` property) and brush size (in its `lineWidth`
147147
property).
148148

149-
(((class (CSS))))(((CSS)))We wrap the canvas and the controls in
149+
(((class attribute)))(((CSS)))We wrap the canvas and the controls in
150150
`<div>` elements with classes to be able to add some styling—for
151151
example the grey border around the picture.
152152

21_skillsharing.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,11 @@ link:13_dom.html#elt[Chapter 13], but the result will still look worse
787787
than HTML, which can be thought of as a ((domain-specific language))
788788
for expressing DOM structures.
789789

790-
(((template)))To create DOM structures for the talks, our program will
791-
define a very simple _templating_ system, which uses hidden DOM
792-
structures included in the document to instantiate new DOM structures,
793-
replacing the ((placeholder))s between double braces with the values
794-
of a specific talk.
790+
(((DOM,construction)))(((template)))To create DOM structures for the
791+
talks, our program will define a very simple _templating_ system,
792+
which uses hidden DOM structures included in the document to
793+
instantiate new DOM structures, replacing the ((placeholder))s between
794+
double braces with the values of a specific talk.
795795

796796
(((script (HTML tag))))Finally, the HTML document includes the script
797797
file that contains the client-side code.
@@ -932,7 +932,7 @@ structure for talks is done using the ((template))s that were included
932932
in the HTML document. First we must define `instantiateTemplate`,
933933
which looks up and fills in a template.
934934

935-
(((class (CSS))))(((querySelector method)))The `name` parameter is the
935+
(((class attribute)))(((querySelector method)))The `name` parameter is the
936936
template's name. To look up the template element, we search for an
937937
element whose class name matches the template name, which is a child
938938
of the element with ID `"template"`. Using the `querySelector` method,

0 commit comments

Comments
 (0)