From ed6103a29fe9ac2c930f2b11dc609acd46ad25be Mon Sep 17 00:00:00 2001 From: Walter Montes Date: Tue, 11 Oct 2022 12:44:51 -0600 Subject: [PATCH] deal with empty nodes Depending on the build setup whitespaces potentially return a `#text` when querying for the first child node, instead, the system must ignore them and pick the node that the user intended to be used. --- src/components/pan-zoom/script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/pan-zoom/script.js b/src/components/pan-zoom/script.js index 4fbcc8f..7741b9c 100644 --- a/src/components/pan-zoom/script.js +++ b/src/components/pan-zoom/script.js @@ -39,7 +39,10 @@ const PanZoomComponent = { else { el = _wrapper.querySelector('svg, object, embed'); if (!el) { - el = _wrapper.firstChild; + for(let i = 0; i < _wrapper.childNodes.length; i++){ + if(_wrapper.childNodes[i].nodeName !== '#text') + el = _wrapper.childNodes[i] + } } } return el;