Errata

JavaScript: The Definitive Guide

Errata for JavaScript: The Definitive Guide

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. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

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

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 609
deleteCount description for Array.splice()

While it would be nice if it was, the deleteCount argument to Array.splice() is not optional according to the ECMAScript v3 spec [1], and according to the spec, a value of undefined should behave the same as the number zero.

When this argument is omitted, you get inconsistent behaviour across browser implementations.

The example given on page 610 states

var a=[1,2,3,4,5,6,7,8];
a.splice(4); // Returns [5,6,7,8]; a is [1,2,3,4]

But the actual results are:
Firefox 2 + 3: Returns [2,3,4,5,6,7,8]; a is [1]
IE 6 + 7: Returns []; a is [1,2,3,4,5,6,7,8]
Opera 9.27: Returns []; a is [1,2,3,4,5,6,7,8]
Opera 9.5: Returns []; a is [2,3,4,5,6,7,8]
Safari 3.1.1: Returns [2,3,4,5,6,7,8]; as is [1]


[1]: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

Note from the Author or Editor:
Deleted the sentence that begins "This argument is optional;..." and replaced it with "Specify 0 to insert elements without deleting any."

Anonymous  Jun 18, 2008  Sep 01, 2008
Printed
Page xxi
2nd paragraph

"His suggestions and technical corrections have make the book clearer and
more precise."
Should be:
"His suggestions and technical corrections have made the book clearer and
more precise."

Anonymous    Aug 01, 2007
Printed
Page 9
near bottom of program example

total.innerHTML = ""
Should be:
total.innerHTML ="";

Anonymous    Aug 01, 2007
Printed
Page 106
para 1 (after chapter heading)

Superfluous comma after "Chapter 3".

Anonymous    Aug 01, 2007
Printed
Page 137
first whole paragraph, first sentence

'rather that as a method'
should be:
'rather than as a method'

Anonymous    Aug 01, 2007
Printed
Page 143
first sentence

"The facts that Javascript ..."
should be
"The fact that Javascript ..."

Anonymous    Aug 01, 2007
Printed
Page 170
Change the 3rd sentence of 9.5.1 so it begins:

"If you have only one level of subclass, you can simplify the syntax..."

At the end of the last paragraph of 9.5.1, add the following:

Note however that this trick only works with shallow inheritance
hierarchies. If B is a subclass of A and C is a subclass of B, and
both B and C use this superclass trick, then when you create an
instance of C, this.superclass will refer to B(), and the B()
constructor will recurse infinitely. For anything other than simple
subclasses, use the construtor chaining technique shown in Example
9-3.

Anonymous    Aug 01, 2007
Printed
Page 171
At the end of section 9.5.2 add a new paragraph

Again, note that this superclass property can only be used once
within an inheritance hierarchy. If a class and a subclass both use
this trick, it will cause infinite recursion.

Anonymous    Aug 01, 2007
Printed
Page 275
code sample, 3rd block


var viewportWidth = window.innerWidth;
var viewportHeight = window.innerWidth;

Should be:

var viewportWidth = window.innerWidth;
var viewportHeight = window.innerHeight;

Anonymous    Aug 01, 2007
Printed
Page 276
example 14-2

if(window.screenLeft){ //IE & others
Geometry.getWindowX = function() { return window.screenLeft; };
Geometry.getWindowY = function() { return window.screenTop; };
}

should be:

if(window.screenLeft === undefined){ //IE & others
Geometry.getWindowX = function() { return window.screenLeft; };
Geometry.getWindowY = function() { return window.screenTop; };
}

Anonymous    Sep 01, 2007
Printed
Page 277
First "if" statement top half of page

"documentElemnet" should be "documentElement"

Anonymous    Aug 01, 2007
Printed
Page 283
section 14.4.5 paragraph 4

"then the focus()" should be "than the focus()"

Anonymous    Aug 01, 2008
Printed
Page 355
Table 16-2

"opacity Specifies how opaque (or translucent) and element is."

"and" should be "an"

Anonymous    Aug 01, 2008
Printed
Page 411
Delete the first two sentences of 17.3.2, and replace them with

Although the IE event model provides event details in an Event
object, IE only passes an event object to handlers registered with
the non-standard <literal>attachEvent()</literal> method (described
below). Other event handlers are invoked with no arguments. Instead
of passing the Event object as an argument to the handler, IE makes
it available as the <literal>event</literal> property of the global
Window object.

Anonymous    Aug 01, 2007
Printed
Page 412
Insert the following as the second sentence of the second paragraph of 17.3.3

An event handler registered with <literal>attachEvent()</literal>
will be invoked with a copy of the global
<literal>window.event</literal> event object.

Anonymous    Aug 01, 2007
Printed
Page 478
footnote, second sentence

"repuration" should be "reputation"

Anonymous    Aug 01, 2007
Printed
Page 479
Add the following just before the start of 20.1.1

The examples in this section and the rest of the chapter are all
part of one larger module. They define utility functions in a
namespace (see Chapter 10) named <literal>HTTP</literal>. None of
the examples include the code to actually create this namespace,
however. The example download bundle includes a file named http.js
that includes this namespace-creation code, and you can simply add
the single line <literal>var HTTP = {};</literal> to the examples
shown here.

Anonymous    Aug 01, 2007
Printed
Page 503
Add the following right before 21.1.1

These utility functions are intended to be part of one large module,
and are all placed in a namespace (see Chapter 10) named XML. The
examples shown here do not include code to actually create this
namespace, however. The example download bundle includes a file
named xml.js that includes this namespace-creation code, and you
can simply add the single line <literal>var XML = {};</literal> to
the examples shown here.

Anonymous    Aug 01, 2007
Printed
Page 707
3rd-to-last line on page

"This provides a useful alternative to String.substring( ) and String.splice( )"
String.splice()
should be
String.slice()

Anonymous    Aug 01, 2007
Printed
Page 933
Title line for XMLHttpRequest

Internet Explorer 5.0
should be
Internet Explorer 7.0

Anonymous    Aug 01, 2007