From 331b78e887821ef75cc8d27159b2a74b632ac5b1 Mon Sep 17 00:00:00 2001 From: Adam Wilson Date: Mon, 4 Sep 2017 14:52:16 +0100 Subject: [PATCH 1/2] Remove empty strings from element children --- index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.js b/index.js index 265a63ce..aa32ccd6 100644 --- a/index.js +++ b/index.js @@ -139,8 +139,19 @@ class SvgUri extends Component{ return responseXML; } + + // Remove empty strings from children array + trimElementChilden(children) { + for (child of children) { + if (typeof child === 'string') { + if (child.trim.length === 0) + children.splice(children.indexOf(child), 1); + } + } + } createSVGElement(node, childs){ + this.trimElementChilden(childs); let componentAtts = {}; const i = ind++; switch (node.nodeName) { From 0350c4577fcb1de2f2ca895203032767cd4a2d89 Mon Sep 17 00:00:00 2001 From: Adam Wilson Date: Wed, 6 Sep 2017 14:16:53 +0100 Subject: [PATCH 2/2] Remove console.log causing spurious log output --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index aa32ccd6..05e544d1 100644 --- a/index.js +++ b/index.js @@ -255,7 +255,6 @@ class SvgUri extends Component{ for (let i = 0; i < node.childNodes.length; i++){ const isTextValue = node.childNodes[i].nodeValue if (isTextValue) { - console.log(node) arrayElements.push(node.childNodes[i].nodeValue) } else { const nodo = this.inspectNode(node.childNodes[i]);