addyosmani / backbone-fundamentals

:book: A creative-commons book on Backbone.js for beginners and advanced users alike

Home Page:http://addyosmani.github.io/backbone-fundamentals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shallow copy or deep copy?

opened this issue · comments

The note about the attributes object passed to validate() says:

This object is distinct from the current attributes of the model and from the parameters passed to the operation. Since it is created by shallow copy, it is not possible to change any Number, String, or Boolean attribute of the input within the function, but it is possible to change attributes in nested objects.

So, the nested objects can be changed because they are deep copied? Aren't nested objects the ones that are shallow copied and everything else (direct members of attributes object) is deep copied?