From 4aa41b98a9471a8334e2428fab977c6c0bd96f86 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Wed, 14 Mar 2018 18:51:48 -0700 Subject: [PATCH] fix dom filtering bug --- src/Type/y-xml/YXmlElement.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Type/y-xml/YXmlElement.js b/src/Type/y-xml/YXmlElement.js index c795879c..263c8e74 100644 --- a/src/Type/y-xml/YXmlElement.js +++ b/src/Type/y-xml/YXmlElement.js @@ -8,6 +8,9 @@ export default class YXmlElement extends YXmlFragment { super() this.nodeName = null this._scrollElement = null + if (typeof arg2 === 'function') { + this._domFilter = arg2 + } if (typeof arg1 === 'string') { this.nodeName = arg1.toUpperCase() } else if (arg1 != null && arg1.nodeType != null && arg1.nodeType === arg1.ELEMENT_NODE) { @@ -16,9 +19,6 @@ export default class YXmlElement extends YXmlFragment { } else { this.nodeName = 'UNDEFINED' } - if (typeof arg2 === 'function') { - this._domFilter = arg2 - } } _copy () { let struct = super._copy() @@ -39,7 +39,7 @@ export default class YXmlElement extends YXmlFragment { // get attribute via getAttribute for custom element support (some write something different in attr.value) attributes.set(attr.name, dom.getAttribute(attr.name)) } - attributes = this._domFilter(dom, attributes) + attributes = this._domFilter(dom.nodeName, attributes) attributes.forEach((value, name) => { this.setAttribute(name, value) })