From: Chris Rebert Date: Thu, 21 Jul 2016 00:21:56 +0000 (-0700) Subject: Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3; fixes... X-Git-Tag: v3.3.7~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2404d30e90450f806e5782738a24ddda774f3bf;p=thirdparty%2Fbootstrap.git Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3; fixes #20280 (#20313) Refs https://github.com/jquery/jquery/issues/3137 [skip validator] --- diff --git a/js/tooltip.js b/js/tooltip.js index 943002199e..f92731b3ea 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -364,7 +364,10 @@ // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) } - var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() + var isSvg = window.SVGElement && el instanceof window.SVGElement + // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3. + // See https://github.com/twbs/bootstrap/issues/20280 + var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset()) var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null