aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/adopter.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-03-29 10:47:16 +1000
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-03-29 10:47:16 +1000
commit28e74482b8cc7b7f2e4aca099ceea9f7d7a888d5 (patch)
treec69f495017fd96aaeee6dd39eb529c2c49e31bf3 /src/utils/adopter.js
parentf8f63d4f976b7ed87d5c6fafcc4c32d9c6d9a270 (diff)
downloadsvg.js-28e74482b8cc7b7f2e4aca099ceea9f7d7a888d5.tar.gz
svg.js-28e74482b8cc7b7f2e4aca099ceea9f7d7a888d5.zip
fixed put and adopter, added tests to cover it
Diffstat (limited to 'src/utils/adopter.js')
-rw-r--r--src/utils/adopter.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/utils/adopter.js b/src/utils/adopter.js
index 30eab84..b016837 100644
--- a/src/utils/adopter.js
+++ b/src/utils/adopter.js
@@ -29,13 +29,15 @@ export function makeInstance (element, isHTML = false) {
}
// Make sure, that HTML elements are created with the correct namespace
- var node = isHTML ? globals.document.createElement('div') : create('svg')
- node.innerHTML = element
+ var wrapper = isHTML ? globals.document.createElement('div') : create('svg')
+ wrapper.innerHTML = element
// We can use firstChild here because we know,
// that the first char is < and thus an element
- element = adopter(node.firstChild)
+ element = adopter(wrapper.firstChild)
+ // make sure, that element doesnt have its wrapper attached
+ wrapper.removeChild(wrapper.firstChild)
return element
}