Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #176 - stickit unbind correctly #183

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions modules/FormView.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,21 @@
* @method delegateEvents
*/
delegateEvents: function() {
View.prototype.delegateEvents.call(this);
/* DOM event bindings and plugins */
this.__generateStickitBindings();
this.stickit();
View.prototype.delegateEvents.call(this);
},

/**
* Override the undelegate events and unwrap our custom additions
* @method undelegateEvents
*/
undelegateEvents: function() {
if (this.$el) {
this.unstickit();
}
View.prototype.undelegateEvents.call(this);
},

/**
Expand All @@ -136,17 +147,6 @@
this._errors = errors;
},

/**
* Deactivate callback that removes bindings and other resources
* that shouldn't exist in a dactivated state
* @method _deactivate
*/
_deactivate: function() {
View.prototype._deactivate.call(this);
// No detach callback... Deactivate will have to do as it is called by detach
this.unstickit();
},

/**
* For use in a feedback's "then" callback
* Checks to see if the form model's field is valid. If the field is invalid, it adds the class.
Expand Down
24 changes: 12 additions & 12 deletions torso-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4819,10 +4819,21 @@
* @method delegateEvents
*/
delegateEvents: function() {
View.prototype.delegateEvents.call(this);
/* DOM event bindings and plugins */
this.__generateStickitBindings();
this.stickit();
View.prototype.delegateEvents.call(this);
},

/**
* Override the undelegate events and unwrap our custom additions
* @method undelegateEvents
*/
undelegateEvents: function() {
if (this.$el) {
this.unstickit();
}
View.prototype.undelegateEvents.call(this);
},

/**
Expand All @@ -4843,17 +4854,6 @@
this._errors = errors;
},

/**
* Deactivate callback that removes bindings and other resources
* that shouldn't exist in a dactivated state
* @method _deactivate
*/
_deactivate: function() {
View.prototype._deactivate.call(this);
// No detach callback... Deactivate will have to do as it is called by detach
this.unstickit();
},

/**
* For use in a feedback's "then" callback
* Checks to see if the form model's field is valid. If the field is invalid, it adds the class.
Expand Down
Loading