1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

Merge pull request #14015 from twbs/possible-14013-fix

Possible fix for #14013
This commit is contained in:
Chris Rebert 2014-07-06 00:36:52 -07:00
commit a34e52de4d
2 changed files with 16 additions and 6 deletions

View file

@ -1418,11 +1418,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$element = $element || this.$element $element = $element || this.$element
var el = $element[0] var el = $element[0]
var isBody = el.tagName == 'BODY' var isBody = el.tagName == 'BODY'
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, { var isSvg = window.SVGElement && el instanceof window.SVGElement
scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(), var outerDims = isSvg ? {} : {
width: isBody ? $(window).width() : $element.outerWidth(), width: isBody ? $(window).width() : $element.outerWidth(),
height: isBody ? $(window).height() : $element.outerHeight() 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) { Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {

View file

@ -316,13 +316,20 @@
Tooltip.prototype.getPosition = function ($element) { Tooltip.prototype.getPosition = function ($element) {
$element = $element || this.$element $element = $element || this.$element
var el = $element[0] var el = $element[0]
var isBody = el.tagName == 'BODY' var isBody = el.tagName == 'BODY'
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, { var isSvg = window.SVGElement && el instanceof window.SVGElement
scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
var elRect = typeof el.getBoundingClientRect == 'function' ? el.getBoundingClientRect() : null
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isSvg ? {} : {
width: isBody ? $(window).width() : $element.outerWidth(), width: isBody ? $(window).width() : $element.outerWidth(),
height: isBody ? $(window).height() : $element.outerHeight() height: isBody ? $(window).height() : $element.outerHeight()
}, isBody ? { top: 0, left: 0 } : $element.offset()) }
return $.extend({}, elRect, scroll, outerDims, elOffset)
} }
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {