diff options
| author | Chris Rebert <[email protected]> | 2014-07-02 10:09:26 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2014-07-02 10:09:28 -0700 |
| commit | 1ce5e9f3aea1c5d2f63d9e0b5a81cf229daccf13 (patch) | |
| tree | 35183a1cd647ed84b9d292119f11e8f8305fe353 | |
| parent | 4715e05510b111b37e796f1458fc7a39a81d6571 (diff) | |
| download | bootstrap-1ce5e9f3aea1c5d2f63d9e0b5a81cf229daccf13.tar.xz bootstrap-1ce5e9f3aea1c5d2f63d9e0b5a81cf229daccf13.zip | |
possible fix for #14013
| -rw-r--r-- | dist/js/bootstrap.js | 9 | ||||
| -rw-r--r-- | js/tooltip.js | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 53da1c77c..afb3d26e7 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -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) { diff --git a/js/tooltip.js b/js/tooltip.js index 9cdb6c9e4..68c5714cd 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -318,11 +318,14 @@ $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) { |
