Errata

Developing Backbone.js Applications

Errata for Developing Backbone.js Applications

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
ePub Page 29
Underscore.js microtemplates

shouldn't the label be:

<label><%= title %></label>

My version shows

<label><%- title %></label>

Jamie Rytlewski  Oct 18, 2013 
Printed Page 36
Next to last line of code example. It reads "var todoView = new TodoView();

new TodoView() fails to set the 'model' property resulting in an error when attempting to execute in render() "this.model.toJSON()"
Problem corrected by

var todoView = new TodoView({ model: myTodo });

Kye Hedlund  Dec 05, 2013 
Printed Page 38
second line

TodosView should be singular. Correct to TodoView

It is confusing to define 2 different objects named
TodoView and TodosView

Kye Hedlund  Dec 05, 2013 
Printed Page 39
2nd paragraph, post code block

It appears as if you are missing a code block for this example in the 'Understanding render()' section. The HTML code block refers to an 'example.js' file, which is not shown afterwards, but is referred to in the following paragraphs.

Jonah Bitautas  Jul 24, 2013 
PDF Page 40
United States

I'm new to backbone but if I understand correctly

this.$el.html()

is a jQuery method which requires a string, so shouldn't the 2 references to

this.$el.html(this.model.toJSON())

have a template function call in them? something like page 36's

this.$el.html( this.todoTpl( this.model.toJSON() ) )

Jonathan Eiten  May 13, 2015 
PDF Page 49
The "sortBy():" example.

The example code for "sortBy()" shows a "console.log("- Now sorted: ");" command. However, in the described output, the text "- Now sorted: " is not present. Maybe it was intentional of the authors to leave out the text "- Now sorted: ", but then it's weird that they placed in the command " console.log("- Now sorted: "); ".

Is this an error?

Ted

Ted Zhu  Sep 21, 2014 
PDF Page 53
In the code just before 'RESTful Persistence'

The following code does not work:

var collection = new Backbone.Collection();
collection
.add({ name: 'John', age: 23 })
.add({ name: 'Harry', age: 33 })
.add({ name: 'Steve', age: 41 });
var names = collection.pluck('name');
console.log(names);

I get the following error:

TypeError: Object [object Object] has no method 'add'

Therefore, chaining is not possible in this context.

Thanks!

Anonymous  Mar 02, 2014 
Printed Page 101
code snippet for : //site/js/views/book.js

ignore comment

// tmpl is a function that takes a JSON object and returns HTML

this is a leftover comment from the older code for (see http://goo.gl/eil9Sv)

John-Paul Holt  Aug 19, 2013 
Printed Page 107
Below 4th Paragraph, Create a Simple Web Server

"body-parser": "~1.9.1" is added to package.json, BUT is NOT added as a Module Dependency in the print edition.

// Module dependencies
var application_root = __dirname,
express = require('express'), //Web framework
path = require( 'path'), //Utilities for dealing with file paths
mongoose = require ('mongoose'); // MongoDB integration


NOTE: The addition of the bodyParser module dependency below.


// Module dependencies
var application_root = __dirname,
express = require('express'), //Web framework
bodyParser = require('body-parser'), //Parser for reading request body
path = require( 'path'), //Utilities for dealing with file paths
mongoose = require ('mongoose'); // MongoDB integration

David May  Oct 22, 2015 
PDF, ePub, Other Digital Version Page 155
end of "Solution 3" section

book said,

Note that InnerView needs to call View.delegateEvents() to bind its event handlers to its new DOM since it is replacing the content of its element.

but actually InnerView doesn't need to call delegateEvents() unless its $el and events properties aren't changed, and if they does, setElement() automatically calls delegateEvents(). I can't come up with any examples require to call delegateEvents().

Byun Eugene  Apr 03, 2014 
PDF Page 310
End page sample code

On collections sample code you use Jasmine 'lingo' when this chapter is about using QUnit along with Sinonjs.

Anonymous  Jul 30, 2013