diff options
Diffstat (limited to 'src/helpers.js')
-rw-r--r-- | src/helpers.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/helpers.js b/src/helpers.js index 90c4995..461975a 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,3 +1,17 @@ +function isNulledBox(box) { + return !box.w && !box.h && !box.x && !box.y +} + +function domContains(node) { + return (document.documentElement.contains || function(node) { + // This is IE - it does not support contains() for top-level SVGs + while (node.parentNode){ + node = node.parentNode; + } + return node == document + }).call(document.documentElement, node) +} + function pathRegReplace(a, b, c, d) { return c + d.replace(SVG.regex.dots, ' .') } @@ -163,10 +177,10 @@ function fullBox(b) { // Get id from reference string function idFromReference(url) { - var m = url.toString().match(SVG.regex.reference) + var m = (url || '').toString().match(SVG.regex.reference) if (m) return m[1] } // Create matrix array for looping -var abcdef = 'abcdef'.split('')
\ No newline at end of file +var abcdef = 'abcdef'.split('') |