This is a rewrite of Todos (Backbone's example application). We rewrote it to provide a simple and complete brunch example. This example also contains a test suite using QUnit. Special thanks to Jérôme Gravel-Niquet for his groundwork.
In this example the todo list renders each list item. This has two disadvantages. Once it lacks performance if you include each item instead of generating the whole list and insert it at once. See http://www.quirksmode.org/dom/innerhtml.html for more Information. Futher you add a lot of event listeners. If you would add the whole list and bind the events to it, the events from the list items bubble up to the list element and you could catch them there.
Why didn't we do that in this example? Unless you have a large set of items the performance difference is not that big, but the code is much easier to read because it's better encapsulated.
Use brunch build
or brunch watch
to compile changes in src folder.
Usually we don't track the js/css files in our repositories, but decided to keep them here because we hope it would be easier to start using it.
To regenerate js test files run
cake compileTests
and view test/index.html
in your browser.
- Add unit tests for views
- Add inline comments