diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-03-16 12:48:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 12:48:20 +0100 |
commit | 9bfcbc184ec99631ea7d2b912e79b1edde17a111 (patch) | |
tree | 46b78b65c8855046e471f6a5254da0b18df9c4f9 /src/helpers.js | |
parent | 3409a2150705f679238300c56c05ea144e9ad7bd (diff) | |
download | svg.js-9bfcbc184ec99631ea7d2b912e79b1edde17a111.tar.gz svg.js-9bfcbc184ec99631ea7d2b912e79b1edde17a111.zip |
unified all boxes (#634)
unified all boxes
- SVG.Box for everything
- bbox, rbox and viewbox as methods
- boxes can be created with string, array, object, list...
- added helper to simplify boxes code
Diffstat (limited to 'src/helpers.js')
-rw-r--r-- | src/helpers.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/helpers.js b/src/helpers.js index b04c506..41f9620 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, ' .') } @@ -185,4 +199,4 @@ function idFromReference(url) { } // Create matrix array for looping -var abcdef = 'abcdef'.split('')
\ No newline at end of file +var abcdef = 'abcdef'.split('') |