addyosmani/backbone-fundamentals — pull request #316 by dcmaf (2013-02-10 03:44:36+00:00)
Title: Chapter 4: "Exercise 1 Todos" - Updates

Worked through the example using the code in the book and added additional
explanation and rewording.

Moved discussion of templates up to the HTML section so that all the HTML
is presented at once. This made it easier to follow what was going on with
the filters in the AppView since the hyperlinks are in the #stats-template.

Moving the templates up caused the two 'In Action' sectons to run together. It
also results in the UI being much more functional initially since the templates
are in place, so it makes less sense to be creating the first couple todos via
the console. I left that part in along with the associated screen shots.

I tested using Backbone 0.9.9. Errors occurred when attempting to use 0.9.10,
so the book example code and discussion will need to be updated when the example
is brought up to 0.9.10.

Is there a memory leak in TodoView? It seems like we are binding to events on the
model in initialize() and one binds destroy on the model directly to removal of
the view, which would seem to delete the view without unbinding the events. Elsewhere
we have said that this can result in memory leaks - or is it not a problem here since
the model has been destroyed? It looks like the latest version of the github TodoMVC
uses listenTo here.

Also fixed a missing '>' in a comment in chapter 3.