From 9bfcbc184ec99631ea7d2b912e79b1edde17a111 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Thu, 16 Mar 2017 12:48:20 +0100 Subject: 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 --- src/helpers.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/helpers.js') 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('') -- cgit v1.2.3