X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/955c8c0702512cabbdcbe296ae278f5e7ff2f497..83754888235eb240748983ec871475a69dfe7a42:/src/smartxml/smartxml.js 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]); },