diff options
author | Chris Rebert <github@chrisrebert.com> | 2016-07-21 03:21:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-21 03:21:56 +0300 |
commit | c2404d30e90450f806e5782738a24ddda774f3bf (patch) | |
tree | 27ee44fd83119d6ff91338954c6c918bb9c0a04d /js | |
parent | d3cbb8eac266ee21b0e653a49f71007e720ccdb2 (diff) |
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]
Diffstat (limited to 'js')
-rw-r--r-- | js/tooltip.js | 5 |
1 files changed, 4 insertions, 1 deletions
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 |