]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3; fixes...
authorChris Rebert <github@chrisrebert.com>
Thu, 21 Jul 2016 00:21:56 +0000 (17:21 -0700)
committerGitHub <noreply@github.com>
Thu, 21 Jul 2016 00:21:56 +0000 (17:21 -0700)
Refs https://github.com/jquery/jquery/issues/3137

[skip validator]

js/tooltip.js

index 943002199e0c635498b4c5c994085b23d02b4438..f92731b3ea243029a396c7cad9fb0ebc7dc1104a 100644 (file)
       // 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