X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e1dee375c870a1771d87701c497b8c1734be6b8a..b5d516652ee4cc58a8a0636074456b344126f7d7:/src/smartxml/smartxml.js?ds=inline diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index acbe04d..000f722 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -34,6 +34,16 @@ $.extend(DocumentNode.prototype, { clone: function() { var clone = this._$.clone(true, true); + clone.find('*').addBack().each(function() { + var clonedData = $(this).data(); + _.pairs(clonedData).forEach(function(pair) { + var key = pair[0], + value = pair[1]; + if(_.isFunction(value.clone)) { + clonedData[key] = value.clone(); + } + }); + }); return this.document.createDocumentNode(clone[0]); },