From f13d76fd5991134f87cd859fc2a88a648506a405 Mon Sep 17 00:00:00 2001 From: Aakash Sethi Date: Fri, 24 Mar 2017 11:21:32 -0700 Subject: [PATCH] Fixed tooltip positioning for SVG elements --- js/foundation.tooltip.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/foundation.tooltip.js b/js/foundation.tooltip.js index e51d928dd..99cf1c26c 100644 --- a/js/foundation.tooltip.js +++ b/js/foundation.tooltip.js @@ -72,8 +72,13 @@ class Tooltip { */ _getPositionClass(element) { if (!element) { return ''; } - // var position = element.attr('class').match(/top|left|right/g); - var position = element[0].className.match(/\b(top|left|right)\b/g); + + var elementClassName = element[0].className; + if (element[0] instanceof SVGElement) { + elementClassName = elementClassName.baseVal; + } + + var position = elementClassName.match(/\b(top|left|right)\b/g); position = position ? position[0] : ''; return position; }; -- 2.47.2