diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-05-04 21:35:21 +1000 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-05-04 21:35:21 +1000 |
commit | c8cb22863bf8c3ac157f6098be9154908aea9ec2 (patch) | |
tree | b27b1bf6ec4c90bbd0cb335e26bb9ece504285d2 /src/elements | |
parent | 59f09a1a2317e57d13bbe8f60e1949cc82199ead (diff) | |
download | svg.js-c8cb22863bf8c3ac157f6098be9154908aea9ec2.tar.gz svg.js-c8cb22863bf8c3ac157f6098be9154908aea9ec2.zip |
Fixed IE Polyfills, got rid of ArrayPolyfill in favour of babels own transforms, updated dependencies, finished tests, removed old es5 tests
Diffstat (limited to 'src/elements')
-rw-r--r-- | src/elements/Dom.js | 7 | ||||
-rw-r--r-- | src/elements/Fragment.js | 25 | ||||
-rw-r--r-- | src/elements/TextPath.js | 7 |
3 files changed, 23 insertions, 16 deletions
diff --git a/src/elements/Dom.js b/src/elements/Dom.js index 1f25c0b..eb59418 100644 --- a/src/elements/Dom.js +++ b/src/elements/Dom.js @@ -264,8 +264,9 @@ export default class Dom extends EventTarget { xml (xmlOrFn, outerXML, ns) { var well, len, fragment - if (xmlOrFn === false) { - outerXML = false + if (typeof xmlOrFn === 'boolean') { + ns = outerXML + outerXML = xmlOrFn xmlOrFn = null } @@ -319,7 +320,7 @@ export default class Dom extends EventTarget { outerXML = outerXML == null ? false : outerXML // Create temporary holder - well = globals.document.createElementNS(ns, 'svg') + well = create('wrapper', ns) fragment = globals.document.createDocumentFragment() // Dump raw svg diff --git a/src/elements/Fragment.js b/src/elements/Fragment.js index 228e93f..d2c4764 100644 --- a/src/elements/Fragment.js +++ b/src/elements/Fragment.js @@ -1,30 +1,31 @@ import Dom from './Dom.js' import { globals } from '../utils/window.js' -import { register } from '../utils/adopter.js' -import Svg from './Svg.js' +import { register, create } from '../utils/adopter.js' class Fragment extends Dom { constructor (node = globals.document.createDocumentFragment()) { super(node) } - // Import / Export raw svg - svg (svgOrFn, outerHTML) { - if (svgOrFn === false) { - outerHTML = false - svgOrFn = null + // Import / Export raw xml + xml (xmlOrFn, outerXML, ns) { + if (typeof xmlOrFn === 'boolean') { + ns = outerXML + outerXML = xmlOrFn + xmlOrFn = null } - // act as getter if no svg string is given - if (svgOrFn == null || typeof svgOrFn === 'function') { - const wrapper = new Svg() + // because this is a fragment we have to put all elements into a wrapper first + // before we can get the innerXML from it + if (xmlOrFn == null || typeof xmlOrFn === 'function') { + const wrapper = new Dom(create('wrapper', ns)) wrapper.add(this.node.cloneNode(true)) - return wrapper.svg(svgOrFn, false) + return wrapper.xml(false, ns) } // Act as setter if we got a string - return super.svg(svgOrFn, false) + return super.xml(xmlOrFn, false, ns) } } diff --git a/src/elements/TextPath.js b/src/elements/TextPath.js index e4208c2..9ed4a71 100644 --- a/src/elements/TextPath.js +++ b/src/elements/TextPath.js @@ -92,7 +92,12 @@ registerMethods({ }), targets () { - return baseFind('svg textPath[*|href*="' + this.id() + '"]') + return baseFind('svg textPath').filter((node) => { + return node.attr('href').includes(this.id()) + }) + + // Does not work in IE11. Use when IE support is dropped + // return baseFind('svg textPath[*|href*="' + this.id() + '"]') } } }) |