mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
added unit tests for Jonathan\'s toJSON() fix
This commit is contained in:
14
dist/kinetic-core.js
vendored
14
dist/kinetic-core.js
vendored
@@ -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;
|
||||
|
||||
|
2
dist/kinetic-core.min.js
vendored
2
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user