-
-var elementTypeFromWlxmlNode = function(wlxmlNode) {
- return wlxmlNode.nodeType === Node.TEXT_NODE ? DocumentTextElement : DocumentNodeElement;
-}
-
-$.extend(DocumentElement, {
- create: function(node, canvas) {
- return elementTypeFromWlxmlNode(node).create(node, canvas);
- },
-
- createDOM: function(wlxmlNode) {
- return elementTypeFromParams(wlxmlNode).createDOM(params);
- },
-
- fromHTMLElement: function(htmlElement, canvas) {
- var $element = $(htmlElement);
- if(htmlElement.nodeType === Node.ELEMENT_NODE && $element.attr('document-node-element') !== undefined)
- return DocumentNodeElement.fromHTMLElement(htmlElement, canvas);
- if($element.attr('document-text-element') !== undefined || (htmlElement.nodeType === Node.TEXT_NODE && $element.parent().attr('document-text-element') !== undefined))
- return DocumentTextElement.fromHTMLElement(htmlElement, canvas);
- return undefined;
- }
-});
+ this.$element = this.createDOM();
+ this.$element.data('canvas-element', this);
+};