Errata

JavaScript: The Missing Manual

Errata for JavaScript: The Missing Manual

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Chapter 5

The exercise at the end of chapter 5 begins by having you add $('span.pq') in the 5.3.html file. In the completed, complete_5.3.html, file $('.pq') is used. The completed version should match the steps in the text. Thanks.

Mike Griffin  Aug 12, 2011 
Printed Page p144
printTime example

So far you only list one confirmed erratum, a missing semicolon. There are actually two.
On 5th May 2010 I sent comprehensive feedback, thank you for your thoughtful reply.
On coming back to the book recently for a closer inspection, I see that every single line (except for all but one of the closing braces) in the "simple function" printTime could be improved, which is quite extraordinary.
You did not even confirm the typo: seperate should be separate.
jslint says that meridiem should be defined with var, which could have been avoided by following your own advice on p498 to use the ternary operator.
jslint also moans about spacing in general, and == instead of ===, which you have not completely unreasonably decided is out of scope and should be deliberately left missing in this missing manual.
It is really helpful to add the range of certain date variables as a comment, e.g. '0'..'59' or '00'..'60' leap second!
Elsewhere in the book a comment // months 0..11 is an excellent habit and a vital bug/erratum saver.
Functions with boolean parameters like secs (how about withSeconds instead) are best factored into two different function names printHoursMinutesSeconds and printHoursMinutes. The truth in printTime(true) is meaningless.
(In Java one is advised to use an enum rather than a boolean parameter).
This function cannot be unit tested unless the caller can provide a date other than just new Date for the current time as a parameter. Why not encourage your "clinical power users" to write a *unit test* first, it might save them having to "troubleshoot and debug" (Ch. 13).
The manual sadly ignores the important subject of internationalization altogether. Indeed the function does not support any other locales or user preferences, and is therefore quite useless in any serious worldwide website. The 24 hour clock is standard in many countries. You could have used conditional code: if (withMeridiem) around the parts that change 0..23 into 1..12 am/pm. The time is ambiguous during a daylight savings change unless you also show the timezone.
Some like to use h for hour as a separator between hours and minutes. The abbreviations am and pm may need translating into another language.
Last and for once least, my editor application complains that there is no line terminator at the end of the file.

Anonymous  Feb 03, 2013 
Printed Page 11
4th paragraph

Second row, repetition: "You'll discover you have two options, you have to options".

Anonymous  Jan 09, 2013 
Printed Page 51
4th paragraph, line 3

I think "...if you need to do any addition..." should be worded "...if you need to do any arithmetic..."

Barry Downs  Apr 22, 2012 
Printed Page 89
Step 9 & step 10

In step 9, we are told to add the line:

luckyNumber = parseInt(luckyNumber, 10);

In Step 10, it shows this same line as:

luckyNumber = parseInt(luckyNumber);


It doesn't seem to make a difference in how th script runs, so this may just be a typo.

Ed Wait  Jul 06, 2011 
Printed Page 114
last paragraph

In the last paragraph of page 114, you said, in the next *section*, you'll learn about jQuery, which should be the next *part*.

Yang Chen  May 09, 2012 
Printed Page 129
3rd line from bottom

backslash after question mark is missing in the line of code: ((\bhttps?:\/\/)|(\bwww\.))\S

should be
((\bhttps?\:\/\/)|(\bwww\.))\S*

Anonymous  Jun 02, 2011 
Printed Page 130
fig 4-4

if my previous correction is not right then in Figure 4-4 there is an erroneous backslash in ((https?\:\/\/)|...

should be: ((https?:\/\/)|...

Anonymous  Jun 02, 2011 
Printed Page 133
In the second paragraph of POWER USERS' CLINIC

The use of replace() method demonstrated on page 132 changes 10.28.2008 to 10/27/2008. But what if you also want to put other formatted dates like 10.28.2008 or 10-28-2008 into the same 10/27/2008 format ?

I feel it should read as follows

The use of replace() method demonstrated on page 132 changes 10.28.2008 to 10/28/2008. But what if you also want to put other formatted dates like 10.28.2008 or 10-28-2008 into the same 10/28/2008 format ?

gopal singh k  Sep 22, 2012 
Printed Page 166
Item #8.

Hi,

In Safari 5.1, when I run:

http://files.sawmac.com/js1e/chapter05/complete_5.1.html

I get the first question BEFORE the page loads. What is up with that?

In Firefox 6, when I run:

http://files.sawmac.com/js1e/chapter05/complete_5.1.html

The page does load before the first question appears, but the header is off the top of the page. I also get these warnings:

Warning: Unknown property '-moz-opacity'. Declaration dropped.
Source File: http://files.sawmac.com/js1e/css/global.css
Line: 10

Warning: Error in parsing value for 'filter'. Declaration dropped.
Source File: http://files.sawmac.com/js1e/css/global.css
Line: 357

Warning: Error in parsing value for 'filter'. Declaration dropped.
Source File: http://files.sawmac.com/js1e/css/global.css
Line: 364

Warning: Error in parsing value for 'cursor'. Declaration dropped.
Source File: http://files.sawmac.com/js1e/css/global.css
Line: 422

It would be nice if there were some sort of forum on the Missing Manuals site where folks that have bought the books could discuss mysterious behavior such as this.

David Arnold
College of the Redwoods

David Arnold  Aug 18, 2011 
200
Step 8

Submitted via Get Satisfaction:
http://getsatisfaction.com/oreilly/topics/chapter_5

Is there a mistake at the end of Chapter 5, it refers to "Step 12" as in "If you don't see a pull quote box, make sure you added the tag in step 12 correctly". As far as I can see, there is only 8 steps in the coding bit of the pull quote bit.

--

It looks like "step 12" in this sentence should actually be "step 2".

Anonymous  Sep 19, 2011 
Printed Page 202
United States

The comma following the closing } of the object literal is missing in Step 8.

Kristine C.  Nov 10, 2013 
Printed Page 220
Item '6.'

Ambigous quotation marks ('''), is this text: three single quotes, a single followed by a double quote, or a double and a single quote? I had to look at the completed code just to resolve this.

Jeremy Hummel  Jun 21, 2012 
Printed Page 320
first example code

Missing right bracket ) for

change(function()

??

Anonymous  May 13, 2012 
Printed Page 430
8. Save file and preview in browser

In the Ajax tutorial of Chapter 11 tutorial using the GET function.

Step 9. mentions you should load your browser and try to submit the form with invalid data. Nothing happens if you use the code that has been provided at this point. You have to add a return false; to the script to make this form response display on the page.

Step 11 mentions adding the return false; to the script but according to your book the tutorial file should be working before adding the return false;, it does not.

Thank you.

In general your books are great. Please make a book that focuses more on Ajax/PHP!

Anonymous  Sep 25, 2011 
Printed Page 520
index entry for Equality Operator (=)

index entry on p520 for Equality Operator (=) and on p524 for Operator Equality (=) should be (==) or even (===)
definitely not (=) which is the assignment operator.
Listed as a top mistake on p470!

Anonymous  Feb 03, 2013