Errata

Dojo: The Definitive Guide

Errata for Dojo: 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.

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 Page 1
At bottom of page 230

is: dojo.addOnLoad(function()
should be: dojo.addOnLoad(function() {

Anonymous   
Printed Page 2
In upper-half of page 231

is:
//A common convention is to use a leading underscore to denote
"private" members
should be:
//A common convention is to use a leading underscore to denote
//"private" members

Anonymous   
Printed Page 3
In bottom-half of page 231

is (on line by itself): this._owners);
should be (delete line):

The same error exists in on-line Safari edition.

Anonymous   
Printed Page 23
Example 1-3

HTML syntax errors and other errors:

<div id="d4"> A div with id=d3 (should it be "with id=d4"?)

"This sentence is in a span that's contained in d1."

(The span is actually in d4, not d1.)

Anonymous   
Printed Page 24
2nd paragraph

The 5th line ends with the word "introspects", this should probably be "inspects"

ed adasiewicz  Feb 26, 2009 
Printed Page 24
3rd paragraph

The 5th line starts with "surfaces IE6 and ...", this should probably be "surfaces in IE6 and ..."

ed adasiewicz  Feb 26, 2009 
Printed Page 37
First paragraph of "Iterating Over Elements"

Should read "The forEach function passes each element of an array into a function that takes one, two or three parameters...".

Last example on page illustrates function taking 2 parameters.

Should explain that first parameter is the element of the array, second (optional) parameter is the index within the array of that element, and third (optional) parameter is the array itself.

Anonymous   
Printed Page 43
Example 2-4

Concatenation operator in

dojo.body().innerHTML = "guess what? fibonnacci(5) = ", dtdg.foo.fibonacci(5);

should be "+" not ","

Anonymous   
Printed Page 44
last paragraph on the page

"... so that no reference to baseUrl or or a call to registerModulePath ..."

should be

"... so that no reference to baseURL or call to registerModulePath ..."

Anonymous   
Printed Page 47
Example 2-7 3rd line within first <script>

djConfig="modulePaths:{dtdg:'./dtdg'},baseUrl:'./'">

should be

djConfig="modulePaths:{dtdg:'./dtdg',baseURL:'./'}">

Anonymous   
Printed Page 47
Example 2-7 3rd line within first <script>

djConfig="modulePaths:{dtdg:'./dtdg'},baseUrl:'./'">

should be

djConfig="modulePaths:{dtdg:'./dtdg',baseURL:'./'}">

Anonymous  Aug 05, 2008 
Printed Page 47
Example 2-7

In the following line of Example 2-7 code:

src="http://o.aolcdn.com/dojo/1.1/dojo/dojo.xd.js">

the closing angle bracket must be deleted, otherwise the demo
will not work.

This is hard to spot error, it also exists in source code (ch02.txt)

Mikalai Zaikin  Feb 17, 2009 
Printed Page 60
3rd para, starting with Dojo attempts to normalize

by exposing the dojo.marginBox attribute, which can take on a value of 'content-box' or 'margin-box' ...

should be
by exposing the dojo.boxModel attribute, which can take on a value

Anonymous   
Printed Page 60
Page 60 3rd para, starting with Dojo attempts to normalize

Their is an errata for the mentioned paragraph, but their is a second mistake. Here is the actual errata:

---

"by exposing the dojo.marginBox attribute, which can take on a value of 'content-box' or 'margin-box' ..."

should be

"by exposing the dojo.boxModel attribute, which can take on a value"

---

This errata should be:

"by exposing the dojo.boxModel attribute, which can take on a value of 'content-box' or 'border-box' ..."

Stefan Trenkel  Apr 12, 2010 
Printed Page 61
Figure 2-3

The illustration does not show the box model properly (or alternatively, it shows what it would look like in IE quirks mode). If the box model is standard (that is, "content-box"), then <div id="foo"> should be 4 pixels square...the 1-pixel border should not be included in that width. The illustration suggests otherwise.

Anonymous  Mar 05, 2010 
Printed Page 65
Example 2-8

Example 2-8 doesn't work on IE7, and is quite confusing while running on Firefox. I changed it a little bit, the code below works for both IE7 and Firefox, and it's more clear. The major difference is the timing for calling dojo.back.addToHistory(). The code below is more realistic: history should be added when user performs some actions perform.

<html>
<head>
<title>Fun with Back!</title>
<link type="text/css" rel="stylesheet" href="http://o.aolcdn.com/dojo/1.1/dojo/resources/dojo.css">
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.1/dojo/dojo.js"
djConfig="parseOnLoad:true, isDebug:true, dojoIframeHistoryUrl: 'iframe_history.html'"></script>

<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.1/dojo/back.js"></script>

<script type="text/javascript">
dojo.addOnLoad(function( ) {
initialState = {
back: function() { console.log("Back to initial state"); }
};
dojo.back.setInitialState(initialState);
});

function linkToState1() {
var state1 = {
back: function( ) { console.log("Back to state 1"); },
forward: function( ) { console.log("Forward to state 1"); },
changeUrl : "state1"
};
dojo.back.addToHistory(state1);
}

function linkToState2() {
var state2 = {
back: function( ) { console.log("Back to state 2"); },
forward: function( ) { console.log("Forward to state 2"); },
changeUrl : "state2"
};
dojo.back.addToHistory(state2);
};
</script>
<head>
<body>
<script type="text/javascript">dojo.back.init( );</script>
Press the back button and have a look at the console.<br/>
<button onclick="linkToState1();">Link to State1</button><br/>
<button onclick="linkToState2();">Link to State2</button><br/>


</body>
</html>

Richard Yin  May 17, 2009 
Printed Page 77
last line on the page

foot.talk() should be foo.greet()

Anonymous   
Printed Page 86
1st line

Code example does not work in dojo 1.1.1

Book has:
handleAs : "json",

Should be:
handleAs : "json-comment-filtered",

Anonymous   
PDF Page 104
File Downloads with IFRAMEs

1. Incomplete URL

navigate to http://localhost:8080/

should be

navigate to http://localhost:8080/download

2. Unclear comment

# update this path to an absolute path on your machine
local_file_path="/tmp/foo.html"

would be clearer as

# absolute path to the file you wish to download
# local_file_path="C:/Temp/foo.html" on a Windows PC
local_file_path="/tmp/foo.html" # on a Linux PC

Anonymous  Nov 10, 2008 
PDF Page 105
Example

On loading the sample html page with FF3, get error:

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
File "C:\Python25\lib\site-packages\cherrypy\_cprequest.py", line 606, in respond
cherrypy.response.body = self.handler()
File "C:\Python25\lib\site-packages\cherrypy\_cpdispatch.py", line 24, in __call__
return self.callable(*self.args, **self.kwargs)
TypeError: upload() takes exactly 2 arguments (1 given)


The solution is not obvious to a beginner like myself.

Bob Furber

Anonymous  Nov 10, 2008 
PDF Page 108
End of CherryPy script

1. Missing code to start up the server:

# start up the web server and have it listen on 8080
cherrypy.quickstart(Content( ), '/')

2. Still does not load htm page:

D:\iii\Projects\Dojo\Examples\iFrames>python iframeUpNH.py
[10/Nov/2008:15:57:12] ENGINE Listening for SIGTERM.
[10/Nov/2008:15:57:12] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[10/Nov/2008:15:57:12] ENGINE Set handler for console events.
[10/Nov/2008:15:57:12] ENGINE Started monitor thread '_TimeoutMonitor'.
[10/Nov/2008:15:57:12] ENGINE Started monitor thread 'Autoreloader'.
[10/Nov/2008:15:57:12] ENGINE Serving on 127.0.0.1:8080
[10/Nov/2008:15:57:12] ENGINE Bus STARTED
[10/Nov/2008:15:57:26] HTTP Traceback (most recent call last):
File "C:\Python25\lib\site-packages\cherrypy\_cprequest.py", line 606, in resp
ond
cherrypy.response.body = self.handler()
File "C:\Python25\lib\site-packages\cherrypy\_cpdispatch.py", line 24, in __ca
ll__
return self.callable(*self.args, **self.kwargs)
TypeError: upload() takes exactly 2 arguments (1 given)

[10/Nov/2008:15:57:26] HTTP
Request Headers:
HOST: localhost:8080
ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
ACCEPT-CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7
USER-AGENT: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/
2008092417 Firefox/3.0.3
CONNECTION: keep-alive
Remote-Addr: 127.0.0.1
ACCEPT-LANGUAGE: en-us,en;q=0.5
ACCEPT-ENCODING: gzip,deflate
KEEP-ALIVE: 300
127.0.0.1 - - [10/Nov/2008:15:57:26] "GET /upload HTTP/1.1" 500 1161 "" "Mozilla
/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.
0.3"


Anonymous  Nov 10, 2008 
PDF Page 111
CherryPy script

1. cherrypy.request.body.read( ) has no attribute 'read'

D:\iii\Projects\Dojo\Examples\JasonRPC>python jsonRPC.py
[10/Nov/2008:16:16:17] ENGINE Listening for SIGTERM.
[10/Nov/2008:16:16:17] ENGINE Bus STARTING
[10/Nov/2008:16:16:17] ENGINE Set handler for console events.
[10/Nov/2008:16:16:17] ENGINE Started monitor thread '_TimeoutMonitor'.
[10/Nov/2008:16:16:17] ENGINE Started monitor thread 'Autoreloader'.
[10/Nov/2008:16:16:18] ENGINE Serving on 127.0.0.1:8080
[10/Nov/2008:16:16:18] ENGINE Bus STARTED
[10/Nov/2008:16:16:57] HTTP Traceback (most recent call last):
File "C:\Python25\lib\site-packages\cherrypy\_cprequest.py", line 606, in resp
ond
cherrypy.response.body = self.handler()
File "C:\Python25\lib\site-packages\cherrypy\_cpdispatch.py", line 24, in __ca
ll__
return self.callable(*self.args, **self.kwargs)
File "jsonRPC.py", line 25, in index
rawPost = cherrypy.request.body.read( )
AttributeError: 'NoneType' object has no attribute 'read'

[10/Nov/2008:16:16:57] HTTP
Request Headers:
HOST: localhost:8080
ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
ACCEPT-CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7
USER-AGENT: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/
2008092417 Firefox/3.0.3
CONNECTION: keep-alive
Remote-Addr: 127.0.0.1
ACCEPT-LANGUAGE: en-us,en;q=0.5
ACCEPT-ENCODING: gzip,deflate
KEEP-ALIVE: 300
127.0.0.1 - - [10/Nov/2008:16:16:57] "GET / HTTP/1.1" 500 1247 "" "Mozilla/5.0 (
Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"

Anonymous  Nov 10, 2008 
Printed Page 133
2/3 down after dojo.style... #eee" }

Missing right paren after dojo.style function call. Also missing in the zip file of examples from the book. Should be background:"#eee"})},
(with right parenthesis between right braces)

Anonymous   
Printed Page 139
Second code example after table

the djConfig value should be "locale:'es'" and not "dojo.locale:'es'".

Martin  Jan 11, 2010 
Printed Page 150
lines 23 and 27 (counting "Example 7-3..." as line 1

<div id="note1" dojoType="dojo.dnd.Moveable"> should be
<div id="note1" dojoType="dojo.dnd.Moveable" handle="dragHandle1"> so that you can click on the textarea without initiating a drag. Likewise for note2. See bottom of page 148.

Anonymous   
Printed Page 206
the last line of the example JSON data

On page 206, the last line of the example JSON data (which is started on the previous page) should be simply "}" and not "k}" (I don't think the "k" should be there).

Anonymous  Nov 17, 2008 
Other Digital Version 212
Example 7.3

In order to only drag the elements using the handlers, the following changes need to be made:
var m1 = new dojo.dnd.Moveable("note1", {handle: "drangHandle1"});
var m2 = new dojo.dnd.Moveable("note2", {handle: "drangHandle2"});

to:

var m1 = new dojo.dnd.Moveable("note1", {handle: "drangHandle1", skip:true});
var m2 = new dojo.dnd.Moveable("note2", {handle: "drangHandle2", skip:true});

e.alhajri  Apr 27, 2010 
Printed Page 217
example 9-15

ItemFileReadStore should be ItemFileWriteStore in example of _saveCustom. (2 places)

Anonymous   
Printed Page 227-228
example 10-5

"constructor(centerX, centerY, color)"
should be
constructor: function(centerX, centerY, color)

and again later in the same example.

Anonymous   
Printed Page 230, 231
A Single Inheritance Example (code)

Anonymous   
Printed Page 257
example 11-2, the 2nd "<head>"

On page 257, example 11-2, the 2nd "<head>" should be "</head>"

Anonymous  Nov 17, 2008 
Printed Page 280
in the code at begining of the page

{
- talk() : function () {
+ talk : function () {

ferz  Feb 08, 2009 
Printed Page 283
middle of page

djConfig=isDebug:true,parseOnLoad:true,baseUrl:'./',modulePaths:{dtdg:'dtdg'}">

double quote is missing when declaring value of djConfig parameter which
makes js crash.

Anonymous  Jun 04, 2009 
Printed Page 283
middle of page

djConfig needs matching double quote

Mike Sweeney  Aug 20, 2010 
Printed Page 290
top

<div

*foo="[0,20,40]"*

bar="[60,80,100]"

baz="{'a':'b', 'c':'d'}"

dojoType="dtd.HelloWorld"

></div>



Hi,
I'm currently ready Dojo - The Definitive Guide, which I like pretty much so
far, I would like to share with some some possible typos/mistakes (I hope
I'm not wrong).
Regards,
Remy Damour
- p. 283:

> *djConfig=is*
> Debug:true,parseOnLoad:true,baseUrl:'./',modulePaths:{dtdg:'dtdg'}*"*>

double quote is missing when declaring value of djConfig parameter which
makes js crash.
- p. 289:

> *constructor: function( )* {
>
console.log("constructor: foo=" , this.foo);
>
console.log("constructor: baz=" , this.baz);
>
}

=> does not produce expected output, it works if we declare this function
not as the constructor but rather as "postMixInProperties", as done in
previous examples.
- p. 290:

> <div

*foo="[0,20,40]"*

bar="[60,80,100]"

baz="{'a':'b', 'c':'d'}"

dojoType="dtd.HelloWorld"

></div>

declaring 'foo' arg as written above does not lead to expected output.
console.log("foo=", this.foo);
//output: foo= ["[0", "20", "40]"]
//expected output: foo= ["0", "20", "40"]
=> foo="[0,20,40]" should rather be foo="0,20,40"
Example within book is still correct (with luck, foo[1] = 20 in both cases),
but what it teaches might be misleading.

Anonymous  Jun 04, 2009 
Printed Page 365
trap box near bottom

setInterval "executes a function according to a set interval" isn't too helpful.

Instead, perhaps, "executes a function repeatedly every time interval, while setTimeout executes a function just once, after a specified amount of time."

Anonymous   
Printed Page 402
bottom of page

Example 16-2 is talking about dtdg/page1.js while th erest of the example on page 403 is using custom/page1.

Anonymous  Oct 19, 2008 
Printed Page 403
Script tag just below middle of page.

This is probably a design mistake, forgetting the purpose of the section:
the inlined djConfig does a "require: ['custom.page1']"
which will fetch the individual dependencies of custom/page1.js
although the whole section has been devoted to putting these dependencies in the form.js layer file.
The example should somehow include "form.js" instead of "custom.page1".

Anonymous  Oct 19, 2008