diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-28 12:57:52 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-28 12:57:52 +0100 |
commit | 58fd0d68bc8b46b23f8cdc65190f08d4e524eb57 (patch) | |
tree | 04247b959cb0517eb4a891c6afbabb734bb892bb /.config/polyfillListIE.js | |
parent | 08b27426fa631a6200a5423161770acab50403bd (diff) | |
download | svg.js-58fd0d68bc8b46b23f8cdc65190f08d4e524eb57.tar.gz svg.js-58fd0d68bc8b46b23f8cdc65190f08d4e524eb57.zip |
Fix build chain so that we now have multiple builds. Details below:
- svg.js: The esm bundle
- svg.min.js: The bundle for all browsers for maximum support
- svg.node.js: The bundle for node
- polyfill.js: Using svg.min.js requires this polyfill in case the Browser does not understand all of ./config/polyfillList.js
- polyfillIE.js: This is required when you use IE11 (polyfill.js still required)
Please note, that not all test pass for IE11 due to its rounding issues and wrong calculation of bbox.
Also note, that `defaultPrevented` is not working for CustomEvents in IE11.
Diffstat (limited to '.config/polyfillListIE.js')
-rw-r--r-- | .config/polyfillListIE.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/.config/polyfillListIE.js b/.config/polyfillListIE.js new file mode 100644 index 0000000..dbffbc5 --- /dev/null +++ b/.config/polyfillListIE.js @@ -0,0 +1,31 @@ +/* global SVGElement */ +/* eslint no-new-object: "off" */ + +import CustomEventPolyfill from '@target/custom-event-polyfill/src/index.js6' +import children from '../src/polyfills/children.js' + +/* IE 11 has no innerHTML on SVGElement */ +import '../src/polyfills/innerHTML.js' + +/* IE 11 has no correct CustomEvent implementation */ +CustomEventPolyfill() + +/* IE 11 has no children on SVGElement */ +try { + if (!SVGElement.prototype.children) { + Object.defineProperty(SVGElement.prototype, 'children', { + get: function () { return children(this) } + }) + } +} catch (e) {} + +/* IE 11 cannot handle getPrototypeOf(not_obj) */ +try { + delete Object.getPrototypeOf('test') +} catch (e) { + var old = Object.getPrototypeOf + Object.getPrototypeOf = function (o) { + if (typeof o !== 'object') o = new Object(o) + return old.call(this, o) + } +} |