From: Aleksander Ɓukasz Date: Thu, 24 Oct 2013 13:02:16 +0000 (+0200) Subject: smartxml: fixing inheritance to support for instanceof operator to work properly X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/6a5fbef4db2934efd05c251124bd2b62180fe549?ds=inline smartxml: fixing inheritance to support for instanceof operator to work properly --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 47e2b2e..a396d3e 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -67,8 +67,9 @@ $.extend(DocumentNode.prototype, { var ElementNode = function(nativeNode, document) { DocumentNode.call(this, nativeNode, document); }; +ElementNode.prototype = Object.create(DocumentNode.prototype); -$.extend(ElementNode.prototype, DocumentNode.prototype, { +$.extend(ElementNode.prototype, { nodeType: Node.ELEMENT_NODE, setData: function(key, value) { @@ -212,8 +213,9 @@ $.extend(ElementNode.prototype, DocumentNode.prototype, { var TextNode = function(nativeNode, document) { DocumentNode.call(this, nativeNode, document); }; +TextNode.prototype = Object.create(DocumentNode.prototype); -$.extend(TextNode.prototype, DocumentNode.prototype, { +$.extend(TextNode.prototype, { nodeType: Node.TEXT_NODE, getText: function() {