can.Map constructor fails if passed another Map #1166

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

Comments

Projects
None yet
3 participants
@zkat
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

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jul 15, 2014

Contributor

What do you expect to happen? Clone?

Contributor

justinbmeyer commented Jul 15, 2014

What do you expect to happen? Clone?

@zkat

This comment has been minimized.

Show comment
Hide comment
@zkat

zkat Jul 15, 2014

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@jawshooah

jawshooah Jul 15, 2014

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())?

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

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jul 16, 2014

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.

Contributor

justinbmeyer commented Jul 16, 2014

@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