ericdrowell/KineticJS — pull request #31 by boatmeme (2012-06-20 02:34:05+00:00)
Title: Calling stage.toJSON() prevents further drawing on existing child layers

The bug producing code is here:

http://jsfiddle.net/BGkBq/

There should be 3 lines, but as you can see, only one is drawn.

If you call stage.toJSON(), you cannot continue to draw() on child layers.

I tracked the bug down to the way attributes are being "copied" from the original node objects to the serialized objects. The problem is that the `var cleanAttrs` is actually an object reference to `node.attrs` and setting `cleanAttrs[key] = undefined`, actually alters the original `node.attrs[key]` value

My pull request changes the approach to implement what I imagine was the original intent. This fixes the bug.

Please let me know if you have any questions.

Fantastic work on the library, btw. The API is a joy to use.