diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-03-08 14:44:45 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-03-08 14:44:45 +0100 |
commit | 7c4e225c01e8db10c687ec502e34b57169d4b65f (patch) | |
tree | eb383085d5a857541ab3cb98f14bb980acf0c42d /dist/svg.js | |
parent | 0534a6760a094d5a9425bde1d89bb8b71ae6a798 (diff) | |
download | svg.js-7c4e225c01e8db10c687ec502e34b57169d4b65f.tar.gz svg.js-7c4e225c01e8db10c687ec502e34b57169d4b65f.zip |
fix documet.contains bug in IE (#612)
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/dist/svg.js b/dist/svg.js index 50d4479..66ac30c 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens <wout@mick-wout.com> * @license MIT * -* BUILT: Wed Mar 08 2017 14:22:41 GMT+0100 (Mitteleuropäische Zeit) +* BUILT: Wed Mar 08 2017 14:43:51 GMT+0100 (Mitteleuropäische Zeit) */; (function(root, factory) { if (typeof define === 'function' && define.amd) { @@ -2223,8 +2223,17 @@ SVG.BBox = SVG.invent({ // yes this is ugly, but Firefox can be a bitch when it comes to elements that are not yet rendered try { - // the element is NOT in the dom, throw error - if(!document.documentElement.contains(element.node)) throw new Exception('Element not in the dom') + if (!document.documentElement.contains){ + // This is IE - it does not support contains() for top-level SVGs + var topParent = element.node; + while (topParent.parentNode){ + topParent = topParent.parentNode; + } + if (topParent != document) throw new Exception('Element not in the dom') + } else { + // the element is NOT in the dom, throw error + if(!document.documentElement.contains(element.node)) throw new Exception('Element not in the dom') + } // find native bbox box = element.node.getBBox() |