X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/72dfc92f908add69b4d862e9b6c3107e2a8acd21..ecf245195f18fa05ff987a10f8e26d53ba8f36ed:/modules/documentCanvas/canvas/documentElement.js diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index 82a85c7..bef9fdd 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -59,7 +59,7 @@ var manipulate = function(e, params, action) { if(params instanceof DocumentElement) { dom = params.dom() } else { - dom = DocumentNodeElement.createDOM(params); + dom = DocumentElement.createDOM(params); } e.dom()[action](dom); return documentElementFromHTMLElement(dom); @@ -132,18 +132,21 @@ $.extend(DocumentNodeElement.prototype, { } }); +DocumentElement.createDOM = function(params) { + var ElementType = params.text !== undefined ? DocumentTextElement : DocumentNodeElement; + return ElementType.createDOM(params); +}; + DocumentNodeElement.createDOM = function(params) { - var dom; - if(params.text) { - dom = $(document.createTextNode(params.text)); - } else { - dom = $('