-DocumentElement.create = function(params, canvas) {
- var ElementType = params.text !== undefined ? DocumentTextElement : DocumentNodeElement;
- return ElementType.create(params);
-};
-
-DocumentElement.createDOM = function(params) {
- var ElementType = params.text !== undefined ? DocumentTextElement : DocumentNodeElement;
- return ElementType.createDOM(params);
-};
-
-DocumentElement.fromHTMLElement = function(htmlElement, canvas) {
- if(htmlElement.nodeType === Node.ELEMENT_NODE)
- return DocumentNodeElement.fromHTMLElement(htmlElement, canvas);
- if(htmlElement.nodeType === Node.TEXT_NODE)
- return DocumentTextElement.fromHTMLElement(htmlElement, canvas);
-}
-
-DocumentNodeElement.createDOM = function(params) {
- var dom = $('<div>').attr('wlxml-tag', params.tag);
- if(params.klass)
- dom.attr('wlxml-class', params.klass);
- return dom;
-};
-
-DocumentTextElement.createDOM = function(params) {
- return $(document.createTextNode(params.text));
-};
-
-DocumentNodeElement.create = function(params, canvas) {
- return this.fromHTMLElement(this.createDOM(params)[0]);
+// DocumentNodeElement represents a text node from WLXML document rendered inside Canvas
+var DocumentTextElement = function(htmlElement, canvas) {
+ DocumentElement.call(this, htmlElement, canvas);