diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-21 22:06:38 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-21 22:06:38 +0100 |
commit | da216c2af803c50ee4bc82ec0e954a1efc1e8a4e (patch) | |
tree | b43dff9760656220aa832d297535a5cb74d30171 /dist | |
parent | ddf28b67dd55aab000a5e6c44f2089c9f0b91ff8 (diff) | |
download | svg.js-da216c2af803c50ee4bc82ec0e954a1efc1e8a4e.tar.gz svg.js-da216c2af803c50ee4bc82ec0e954a1efc1e8a4e.zip |
rewrite few lines of adopter
Diffstat (limited to 'dist')
-rw-r--r-- | dist/svg.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/dist/svg.js b/dist/svg.js index 9d7a861..5407a1a 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens <wout@mick-wout.com> * @license MIT * -* BUILT: Wed Nov 21 2018 10:58:56 GMT+0100 (GMT+01:00) +* BUILT: Wed Nov 21 2018 22:04:17 GMT+0100 (GMT+01:00) */; var SVG = (function () { 'use strict'; @@ -437,19 +437,17 @@ var SVG = (function () { } // initialize variables - var element; // adopt with element-specific settings + var className = capitalize(node.nodeName); - if (node.nodeName === 'svg') { - element = new elements[root](node); - } else if (node.nodeName === 'linearGradient' || node.nodeName === 'radialGradient') { - element = new elements.Gradient(node); - } else if (elements[capitalize(node.nodeName)]) { - element = new elements[capitalize(node.nodeName)](node); - } else { - element = new elements.Bare(node); + if (className === 'LinearGradient' || className === 'RadialGradient') { + className = 'Gradient'; } - return element; + if (!elements[className]) { + className = 'Bare'; + } + + return new elements[className](node); } function register(element) { var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : element.name; |