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

This fixes as bug when have an attribute in a view and specify an ID to the constructor #1172

Merged
merged 2 commits into from
Apr 2, 2012

Conversation

ansman
Copy link
Contributor

@ansman ansman commented Apr 2, 2012

Here is an example of the problem:

v = Backbone.View.extend({attributes: {}})
v1 = new v({id: 'foo'})
v1.el # <div id=​"foo">​</div>​
v2 = new v()
v2.el # <div id=​"foo">​</div>​

This pull request fixes that, it also includes a test case for this bug.

ansman added 2 commits April 2, 2012 12:37
The problem is that the attribute object isn't cloned so when an ID is
set through the constructor attributes[id] will get set on all
subsequent objects as well.
@jashkenas
Copy link
Owner

Thanks.

jashkenas added a commit that referenced this pull request Apr 2, 2012
This fixes as bug when have an attribute in a view and specify an ID to the constructor
@jashkenas jashkenas merged commit bc922ab into jashkenas:master Apr 2, 2012
jashkenas added a commit that referenced this pull request Apr 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants