Commit 1e0e1908 authored by Jeremy Darling's avatar Jeremy Darling Committed by Stephen Sawchuk

Minor bug fix in controller.js Controller.prototype.removeItem

Controller.prototype.removeItem did not check if the item was available
via the DOM before calling removeChild.  If you were only viewing
"active" and clicked the "Clear completed" button it would result in an
error.  Wrapped the remvoeChild call in an if statement to validate
existence of the elememnt.
parent 22587178
......@@ -163,7 +163,11 @@
*/
Controller.prototype.removeItem = function (id) {
this.model.remove(id, function () {
this.$todoList.removeChild($$('[data-id="' + id + '"]'));
var elem = $$('[data-id="' + id + '"]');
if (elem) {
this.$todoList.removeChild(elem);
}
}.bind(this));
this._filter();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment