From 3bf4372aec40f1f3296e34cc119da459feaf8ddf Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Thu, 19 Mar 2015 16:25:20 -0700 Subject: [PATCH] Fix toggling parents breaking children jquery event handlers --- dist/flowy.js | 2 +- src/models/test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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')); -- 2.47.3