Browse files

adding lively.persistence.Serializer.copy as alias for lively.persist…

…ence.Serializer.newMorphicCopy, whitespaces
  • Loading branch information...
1 parent 05d91bc commit 9348e0c1aa6ac58d7ffb805fe967fdee7a484fc0 @rksm committed May 6, 2012
Showing with 13 additions and 9 deletions.
  1. +13 −9 core/lively/persistence/Serializer.js
View
22 core/lively/persistence/Serializer.js
@@ -1146,8 +1146,9 @@ Object.extend(lively.persistence.Serializer, {
},
serializeWorldToDocumentWithSerializer: function(world, doc, serializer) {
- // this helper object was introduced to make the code that is browser dependent
- // (currently IE9 vs the rest) easier to read. It sould be moved to dome general DOM abstraction layer
+ // this helper object was introduced to make the code that is browser
+ // dependent (currently IE9 vs the rest) easier to read. It sould be
+ // moved to dome general DOM abstraction layer
var domAccess = {
getSystemDictNode: function(doc) {
return (doc.getElementById ?
@@ -1179,18 +1180,16 @@ Object.extend(lively.persistence.Serializer, {
var head = domAccess.getHeadNode(doc);
// FIXME remove previous meta elements - is this really necessary?
- //var metaElement;
- //while (metaElement = doc.getElementsByTagName('meta')[0])
+ // var metaElement;
+ // while (metaElement = doc.getElementsByTagName('meta')[0])
// metaElement.parentNode.removeChild(metaElement)
// removed 2012-01-5 fabian
// doing this instead: remove old serialized data.. is it necessary or not?
// we need additional meta tags for better iPad touch support, can't remove all of them..
var metaToBeRemoved = ['LivelyMigrationLevel', 'WorldChangeSet', 'LivelyJSONWorld'];
metaToBeRemoved.forEach(function(ea) {
var element = doc.getElementById(ea);
- if (element) {
- element.parentNode.removeChild(element);
- }});
+ if (element) { element.parentNode.removeChild(element); }});
// FIXME remove system dictionary
@@ -1223,8 +1222,8 @@ Object.extend(lively.persistence.Serializer, {
return doc;
},
deserialize: function(json, optDeserializer) {
- var deserializer = optDeserializer || this.createObjectGraphLinearizer();
- var obj = deserializer.deserialize(json);
+ var deserializer = optDeserializer || this.createObjectGraphLinearizer(),
+ obj = deserializer.deserialize(json);
return obj;
},
@@ -1269,6 +1268,11 @@ Object.extend(lively.persistence.Serializer, {
},
newMorphicCopy: function(obj) {
+ // this method exists for compatibility
+ return this.copy(obj);
+ },
+
+ copy: function(obj) {
var serializer = this.createObjectGraphLinearizerForCopy();
serializer.showLog = false;
var copyPlugin = new CopyOnlySubmorphsPlugin();

0 comments on commit 9348e0c

Please sign in to comment.