aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/adopter.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-05-04 21:35:21 +1000
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2020-05-04 21:35:21 +1000
commitc8cb22863bf8c3ac157f6098be9154908aea9ec2 (patch)
treeb27b1bf6ec4c90bbd0cb335e26bb9ece504285d2 /src/utils/adopter.js
parent59f09a1a2317e57d13bbe8f60e1949cc82199ead (diff)
downloadsvg.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/utils/adopter.js')
-rw-r--r--src/utils/adopter.js40
1 files changed, 4 insertions, 36 deletions
diff --git a/src/utils/adopter.js b/src/utils/adopter.js
index a136655..2de1b27 100644
--- a/src/utils/adopter.js
+++ b/src/utils/adopter.js
@@ -8,9 +8,9 @@ const elements = {}
export const root = '___SYMBOL___ROOT___'
// Method for element creation
-export function create (name) {
+export function create (name, ns = svg) {
// create element
- return globals.document.createElementNS(svg, name)
+ return globals.document.createElementNS(ns, name)
}
export function makeInstance (element, isHTML = false) {
@@ -114,26 +114,18 @@ export function assignNewId (node) {
}
// Method for extending objects
-export function extend (modules, methods, attrCheck) {
+export function extend (modules, methods) {
var key, i
modules = Array.isArray(modules) ? modules : [ modules ]
for (i = modules.length - 1; i >= 0; i--) {
for (key in methods) {
- let method = methods[key]
- if (attrCheck) {
- method = wrapWithAttrCheck(methods[key])
- }
- modules[i].prototype[key] = method
+ modules[i].prototype[key] = methods[key]
}
}
}
-// export function extendWithAttrCheck (...args) {
-// extend(...args, true)
-// }
-
export function wrapWithAttrCheck (fn) {
return function (...args) {
const o = args[args.length - 1]
@@ -145,27 +137,3 @@ export function wrapWithAttrCheck (fn) {
}
}
}
-
-export function invent (config) {
- // Create element initializer
- var initializer = typeof config.create === 'function'
- ? config.create
- : function (node) {
- this.constructor(node || create(config.create))
- }
-
- // Inherit prototype
- if (config.inherit) {
- /* eslint new-cap: off */
- initializer.prototype = new config.inherit()
- initializer.prototype.constructor = initializer
- }
-
- // Extend with methods
- if (config.extend) { extend(initializer, config.extend) }
-
- // Attach construct method to parent
- if (config.construct) { extend(config.parent || elements.Container, config.construct) }
-
- return initializer
-}