-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
views: events getting called before initialize in 1.2.*? #3704
Comments
Turn your events hash into a method or use |
so turn it into a method and call it from |
No, you can either turn var View = Backbone.View.extend({
events: function() {
return {
'click span': 'onClickSpan',
'click': 'onClick'
};
}
});
// OR
var View = Backbone.View.extend({
initialize: function() {
this.delegate('click', 'span', this.onClickSpan);
this.delegate('click', this.onClick);
}
}); |
thank @jridgewell @akre54. So I've been doing that, but I was relying on initialize being called before the events method:
this pattern no longer works in Backbone 1.2.* |
@jridgewell, sorry to be a nuisance, but what was the motivation for making these changes? |
See #3060 (comment). |
just updated backbone to 1.2.* from 1.1.2 and I'm running into an issue in my views where the
events
block is being called before theinitialize
block. Was this an intentional change? I didn't see this in the changelog.Had to lock into 1.1.2 since this change is breaking my app. (I conditionally extend the events hash depending on options set within the initialize block.)
The text was updated successfully, but these errors were encountered: