Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Store bindings in each view, instead of a globally shared array #8

merged 1 commit into from

2 participants


Previously, the _modelBindings array was shared among all views, which means when one view is destroyed, all of the bindings in all views are lost.

Should I provide tests reproducing the problem?

@delambo delambo merged commit 66ad734 into NYTimes:master

@KidkArolis Thanks! I think this cleans up the multi-view use-case that I hacked into issue #4.


@KidkArolis Heads up - I just committed an additional fix for this to master (the case when multiple models are initialized by calling stickit again).


Good stuff :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 backbone.stickit.js
4 backbone.stickit.js
@@ -9,7 +9,7 @@
// Collection of model event bindings.
// [{model,event,fn}, ...]
- _modelBindings: [],
+ _modelBindings: null,
// Unbind the model bindings that are referenced in `this._modelBindings`.
unstickModel: function() {
@@ -26,6 +26,8 @@
model = optionalModel || this.model,
bindings = optionalBindingsConfig || this.bindings || {};
+ this._modelBindings = [];
+ || ( = {});
// Setup a model event binding with the given function, and track the event in this._modelBindings.
Something went wrong with that request. Please try again.