From: Zachary Vance Date: Thu, 19 Mar 2015 23:25:20 +0000 (-0700) Subject: Fix toggling parents breaking children jquery event handlers X-Git-Url: https://git.za3k.com/?a=commitdiff_plain;h=3bf4372aec40f1f3296e34cc119da459feaf8ddf;p=flowy.git Fix toggling parents breaking children jquery event handlers --- diff --git a/dist/flowy.js b/dist/flowy.js index 052a922..bf6b3a3 100644 --- a/dist/flowy.js +++ b/dist/flowy.js @@ -136,7 +136,7 @@ var TodoView = Backbone.View.extend({ return this; }, render: function() { - var oldChildren = this.$el.find("> .bullets > *"); + var oldChildren = this.$el.find("> .bullets > *").detach(); // detach keeps handlers this.$el.html(Mustache.to_html(this.template, this.model.toJSON())); // Should hopefully be model.attributes this.$el.toggleClass('completed', this.model.get('completed')); this.$el.toggleClass('collapsed', this.model.get('collapsed')); diff --git a/src/models/test.js b/src/models/test.js index 052a922..bf6b3a3 100644 --- a/src/models/test.js +++ b/src/models/test.js @@ -136,7 +136,7 @@ var TodoView = Backbone.View.extend({ return this; }, render: function() { - var oldChildren = this.$el.find("> .bullets > *"); + var oldChildren = this.$el.find("> .bullets > *").detach(); // detach keeps handlers this.$el.html(Mustache.to_html(this.template, this.model.toJSON())); // Should hopefully be model.attributes this.$el.toggleClass('completed', this.model.get('completed')); this.$el.toggleClass('collapsed', this.model.get('collapsed'));