diff --git a/src/lib/dom-api.html b/src/lib/dom-api.html index 1be13b3bde..7295e4422a 100644 --- a/src/lib/dom-api.html +++ b/src/lib/dom-api.html @@ -711,6 +711,15 @@ } else { + var forwardMethods = ['cloneNode', 'appendChild', 'insertBefore', + 'removeChild', 'replaceChild']; + + forwardMethods.forEach(function(name) { + DomApi.prototype[name] = function() { + return this.node[name].apply(this.node, arguments); + } + }); + DomApi.prototype.querySelectorAll = function(selector) { return Array.prototype.slice.call(this.node.querySelectorAll(selector)); }; @@ -725,10 +734,6 @@ } }; - DomApi.prototype.cloneNode = function(deep) { - return this.node.cloneNode(deep); - } - DomApi.prototype.importNode = function(externalNode, deep) { var doc = this.node instanceof Document ? this.node : this.node.ownerDocument; @@ -788,11 +793,11 @@ }); - var forwards = ['parentNode', 'firstChild', 'lastChild', 'nextSibling', - 'previousSibling', 'firstElementChild', 'lastElementChild', + var forwardProperties = ['parentNode', 'firstChild', 'lastChild', + 'nextSibling', 'previousSibling', 'firstElementChild', 'lastElementChild', 'nextElementSibling', 'previousElementSibling']; - forwards.forEach(function(name) { + forwardProperties.forEach(function(name) { Object.defineProperty(DomApi.prototype, name, { get: function() { return this.node[name];