added unit tests for Jonathan\'s toJSON() fix

This commit is contained in:
Eric Rowell
2012-06-21 21:46:52 -07:00
parent ca6e8f1d14
commit 40a92a9988
7 changed files with 39 additions and 14 deletions

14
dist/kinetic-core.js vendored
View File

@@ -1725,18 +1725,16 @@ Kinetic.Stage.prototype = {
function addNode(node) {
var obj = {};
var cleanAttrs = node.attrs;
obj.attrs = {};
// remove function, image, DOM, and objects with methods
for(var key in cleanAttrs) {
var val = cleanAttrs[key];
if(go._isFunction(val) || go._isElement(val) || go._hasMethods(val)) {
cleanAttrs[key] = undefined;
// serialize only attributes that are not function, image, DOM, or objects with methods
for(var key in node.attrs) {
var val = node.attrs[key];
if(!go._isFunction(val) && !go._isElement(val) && !go._hasMethods(val)) {
obj.attrs[key] = val;
}
}
obj.attrs = cleanAttrs;
obj.nodeType = node.nodeType;
obj.shapeType = node.shapeType;

File diff suppressed because one or more lines are too long