Skip to content

Commit

Permalink
Handle lack of .width and .height from getBoundingClientRect() in IE8
Browse files Browse the repository at this point in the history
  • Loading branch information
cvrebert committed Aug 30, 2014
1 parent fe89692 commit eaf21ec
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,17 @@
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 = {
bottom: elRect.bottom,
top: elRect.top,
right: elRect.right,
left: elRect.left,
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 ? {} : {
Expand Down

0 comments on commit eaf21ec

Please sign in to comment.