Skip to content

Commit eaa1655

Browse files
committed
Remove confusing claim about remainder and bitmasks in Chapter 15
1 parent c532452 commit eaa1655

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

15_event.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,8 @@ that, we can use the `buttons` property (note the plural), which tells
508508
us about the buttons that are currently held down. When this is zero,
509509
no buttons are down. When buttons are held, its value is the sum of
510510
the codes for those buttons—the left button has code 1, the right
511-
button 2, and the middle one 4. That way, you can check whether a given
512-
button is pressed by taking the remainder of the value of `buttons`
513-
and its code.
511+
button 2, and the middle one 4. With the left and right buttons held,
512+
for example, the value of `buttons` will be 3.
514513

515514
Note that the order of these codes is different from the one used by
516515
`button`, where the middle button came before the right one. As

html/errata.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ <h2>Chapter 14</h2>
7878

7979
<h2>Chapter 15</h2>
8080

81+
<p><strong>Page 255</strong> <em>Mouse Motion</em>: The second
82+
paragraph on the page claims that you can isolate a button from
83+
the <code>buttons</code> bitmask with the remainder operator, but that
84+
doesn't really work (you'd also need a division and a floor, which
85+
gets too obscure to go into in this chapter).</p>
86+
8187
<p><strong>Page 258</strong> (3rd) <em>Load Event</em>: The description of
8288
the <code>beforeunload</code> claims that you just need to return a
8389
string from your event handler. For handlers registered

0 commit comments

Comments
 (0)