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

can.Map constructor fails if passed another Map #1166

Closed
zkat opened this issue Jul 15, 2014 · 4 comments
Closed

can.Map constructor fails if passed another Map #1166

zkat opened this issue Jul 15, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@zkat
Copy link
Contributor

zkat commented Jul 15, 2014

If you try and pass an instance of can.Map into the can.Map constructor, there's an error.

See: http://jsfiddle.net/mhraL/3/

@justinbmeyer
Copy link
Contributor

What do you expect to happen? Clone?

@zkat
Copy link
Contributor Author

zkat commented Jul 15, 2014

Yeah. I know I can .attr() it, but the error can be really confusing, and this seems to have been a relatively recent change -- I ran into it while upgrading an app running on 2.0

@jawshooah
Copy link

Might be better for it to just return the argument. Maybe add a .clone() method that's just a wrapper for new can.Map(map.attr())?

@justinbmeyer
Copy link
Contributor

@jawshooah, it might be better to clone. I think not returning a new instance when new is called would be confusing. Plus, I'm not sure that this can easily be made to happen with can.Construct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants