From: Aleksander Ɓukasz Date: Fri, 25 Oct 2013 13:32:40 +0000 (+0200) Subject: smartxml: fixing text node creation X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/24f79c15db362b3646ce15d0dc6d9c703040e892 smartxml: fixing text node creation --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index b4036d3..cbb2ba8 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -319,7 +319,13 @@ $.extend(Document.prototype, Backbone.Events, { from = node[0]; } } - return new this.ElementNodeFactory(from, this); + var Factory; + if(from.nodeType === Node.TEXT_NODE) { + Factory = this.TextNodeFactory; + } else if(from.nodeType === Node.ELEMENT_NODE) { + Factory = this.ElementNodeFactory; + } + return new Factory(from, this); }, createTextNode: function(nativeNode) {