]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
possible fix for #14013
authorChris Rebert <code@rebertia.com>
Wed, 2 Jul 2014 17:09:26 +0000 (10:09 -0700)
committerChris Rebert <code@rebertia.com>
Wed, 2 Jul 2014 17:09:28 +0000 (10:09 -0700)
dist/js/bootstrap.js
js/tooltip.js

index 53da1c77c084d31b416536df1d7c055a5e362637..afb3d26e7ddcfb5da44568caafc20f86b776bdaa 100644 (file)
@@ -1418,11 +1418,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
     $element   = $element || this.$element
     var el     = $element[0]
     var isBody = el.tagName == 'BODY'
-    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
-      scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
+    var isSvg = window.SVGElement && el instanceof window.SVGElement
+    var outerDims = isSvg ? {} : {
       width:  isBody ? $(window).width()  : $element.outerWidth(),
       height: isBody ? $(window).height() : $element.outerHeight()
-    }, isBody ? { top: 0, left: 0 } : $element.offset())
+    }
+    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
+      scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop()
+    }, outerDims, isBody ? { top: 0, left: 0 } : $element.offset())
   }
 
   Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
index 9cdb6c9e4de32abed514bda166ae7d993cfd9b20..68c5714cdda854fa509d44c57240214c1efa3941 100644 (file)
     $element   = $element || this.$element
     var el     = $element[0]
     var isBody = el.tagName == 'BODY'
-    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
-      scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
+    var isSvg = window.SVGElement && el instanceof window.SVGElement
+    var outerDims = isSvg ? {} : {
       width:  isBody ? $(window).width()  : $element.outerWidth(),
       height: isBody ? $(window).height() : $element.outerHeight()
-    }, isBody ? { top: 0, left: 0 } : $element.offset())
+    }
+    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
+      scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop()
+    }, outerDims, isBody ? { top: 0, left: 0 } : $element.offset())
   }
 
   Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {