]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Handle lack of .width and .height from getBoundingClientRect() in IE8 14492/head
authorChris Rebert <code@rebertia.com>
Sat, 30 Aug 2014 20:02:05 +0000 (13:02 -0700)
committerChris Rebert <code@rebertia.com>
Mon, 8 Sep 2014 05:58:33 +0000 (22:58 -0700)
Closes #14093
Correction to #14090
Relevant docs: https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect#Browser_compatibility

js/tooltip.js

index e730db6e95672ea0faf9ad97359b6a0f30f0f3c7..93e21e691997bc601318cfbb626aa10c81fab0da 100644 (file)
     var isSvg  = window.SVGElement && el instanceof window.SVGElement
 
     var elRect    = el.getBoundingClientRect()
+    if (elRect.width == null) {
+      // 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 scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
     var outerDims = isSvg ? {} : {