-
-
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
Implemented Spine-like elements configuration #569
Conversation
This is still up for discussion since #511 (comment) pointed out the potential issue of not having ...
el: '#foo'
elements: {
'h1': 'title',
'h4': 'subtitle'
}
... If dependent on the ...
template: _.template('<hgroup><h1><%= this.title %></h1><h4><%= this.subtitle %></h4></hgroup>'),
render: function() {
this.el = this.template(this.model.toJSON());
this.setLocalElements();
}
... |
A huge +1 for this, in our Backbone app we are using class level properties suffixed with |
+1 |
+2 |
+1 |
bump for merging. there seems to be a decent following. |
+1 |
Worth pointing out that this issue marries up nicely to issue #374's goal of implementing the more useful features from Spine.js |
Includes: - jashkenas/backbone#569 ability to define local elements - jashkenas/backbone#446 integrate Collection.update - jashkenas/backbone#570 ability to pass a single attr/value pair in `set' and `save' - jashkenas/backbone#567 this.el being the jQuery/Zepto object
+1 |
There are a couple of potential problems here ...
Even if you wait that long, the elements probably won't be available until after Really, this is a premature optimization. You should be using the very tightly scoped |
+1 |
@jashkenas Your concern regarding when All your concerns regarding overriding the I don't understand why you mention that I should be using |
The point of having a root "el" and using event delegation is that events can be delegated before the UI is rendered and their elements actually exist. The same is not true for jQuery selectors. You'll end up with a bunch of empty jQuery objects if |
Implementation of this feature from Spine: http://maccman.github.com/spine/#s-controllers-elements
Reopened from #511 that has been rebased with master.