bitovi/canjs — pull request #435 by airhadoken (2013-06-18 07:16:33+00:00)
Title: can.Observe.Clone

Cloning an Observe instance, by calling clone() on it, copies its properties (optionally deep-cloning nested Observes) to a new object that's an instance of the class's Clone child class. The original Observe's prototype is available in the clone object's prototype chain, in addition to the merge() function, which pushes any changes back to the original object and effectively destroys the clone copy.

Additionally, saving a Clone of a can.Model functions much like a merge() with a round-trip to the AJAX endpoint.

Example use:
make a clone of a page model to populate an Edit form. The original display of the model data is unchanged while pushing form data into the clone copy. When the form is saved by calling save() on the clone model, the original model and any of its live-bound views are updated.