chaplinjs/chaplin — pull request #288 by molily (2012-12-04 23:17:59+00:00)
Title: On serialization, also protect nested models by using delegator objects....

... Improve Backbone model support.

See #284. I don’t think this is absolutely necessary. For me this is an edge case, and it also has a small performance impact. But for consistency reasons, we might choose this way, so I prepared a PR for further discussion.

The basic change is to create a delegator object for nested models, too. Writing properties of the nested models in `getTemplateData` will create properties on the delegator and won’t modify the original model.

Of course, this isn’t a deep copy, so changing complex objects will still change the original model attributes.