Fix bug with toJSON, all properies of nodes were not serialized if some native objects of JS were extended.

This commit is contained in:
David Johansson 2012-09-24 21:26:13 +02:00
parent a349fa488c
commit 8f8fcc8a90
3 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@
* http://www.kineticjs.com/ * http://www.kineticjs.com/
* Copyright 2012, Eric Rowell * Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses. * Licensed under the MIT or GPL Version 2 licenses.
* Date: Sep 23 2012 * Date: Sep 24 2012
* *
* Copyright (C) 2011 - 2012 by Eric Rowell * Copyright (C) 2011 - 2012 by Eric Rowell
* *
@ -2874,7 +2874,7 @@ Kinetic.Stage.prototype = {
// serialize only attributes that are not function, image, DOM, or objects with methods // serialize only attributes that are not function, image, DOM, or objects with methods
for(var key in node.attrs) { for(var key in node.attrs) {
var val = node.attrs[key]; var val = node.attrs[key];
if(!type._isFunction(val) && !type._isElement(val) && !type._hasMethods(val)) { if(!type._isFunction(val) && !type._isElement(val) && !(type._isObject(val) && type._hasMethods(val))) {
obj.attrs[key] = val; obj.attrs[key] = val;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -133,7 +133,7 @@ Kinetic.Stage.prototype = {
// serialize only attributes that are not function, image, DOM, or objects with methods // serialize only attributes that are not function, image, DOM, or objects with methods
for(var key in node.attrs) { for(var key in node.attrs) {
var val = node.attrs[key]; var val = node.attrs[key];
if(!type._isFunction(val) && !type._isElement(val) && !type._hasMethods(val)) { if(!type._isFunction(val) && !type._isElement(val) && !(type._isObject(val) && type._hasMethods(val))) {
obj.attrs[key] = val; obj.attrs[key] = val;
} }
} }