diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-24 11:17:13 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-24 11:17:13 +0100 |
commit | 858f19e9f8b9ba26eee8d3aeb8ba8b5b5058472b (patch) | |
tree | fa0c355901bf93e6dc418a759f06ab7899e0452a /src/utils | |
parent | 8555e13b252f07f8079b08c0b29f4399d389b1e0 (diff) | |
download | svg.js-858f19e9f8b9ba26eee8d3aeb8ba8b5b5058472b.tar.gz svg.js-858f19e9f8b9ba26eee8d3aeb8ba8b5b5058472b.zip |
Get rid of HTMLNode and Bare in favor of Dom
- words() and element() added to Dom
- svg() now returns the _parent_ of the imported element, when outerHTML is true (which means an element gets replaces)
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/adopter.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/utils/adopter.js b/src/utils/adopter.js index 6109f22..52d589e 100644 --- a/src/utils/adopter.js +++ b/src/utils/adopter.js @@ -50,19 +50,16 @@ export function adopt (node) { // make sure a node isn't already adopted if (node.instance instanceof Base) return node.instance - if (!(node instanceof globals.window.SVGElement)) { - return new elements.HtmlNode(node) - } - // initialize variables var className = capitalize(node.nodeName) + // Make sure that gradients are adopted correctly if (className === 'LinearGradient' || className === 'RadialGradient') { className = 'Gradient' - } - if (!elements[className]) { - className = 'Bare' + // Fallback to Dom if element is not known + } else if (!elements[className]) { + className = 'Dom' } return new elements[className](node) |