thecodealer / vue-panzoom

Vue plugin to zoom/pan dom elements
MIT License
89 stars 20 forks source link

Deal with `#text` nodes from whitespaces #41

Open walmon opened 1 year ago

walmon commented 1 year ago

Depending on the build setup whitespaces will potentially be turned into #text nodes, so when querying for the first child node as the current code does it breaks the plugin. Instead, it should ignore #text nodes and pick the node that the user actually intended to be used.

This change should not break setups where whitespaces are not kept and therefore turned into #text nodes as if there's a single node, then the system will take that instance anyway (same as it used to do with firstChild.

See mdn reference.