Skip to content

Commit e6e48ef

Browse files
committed
iOS8+ fix
1 parent 081edb8 commit e6e48ef

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@
4141
"scripts": {
4242
"test": "echo \"Error: no test specified\" && exit 1"
4343
},
44-
"version": "4.0.4"
44+
"version": "4.0.5"
4545
}

src/js/tooltipster.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,6 @@ $.Tooltipster.prototype = {
18141814
});
18151815
});
18161816

1817-
18181817
if ( self.__options.triggerClose.mouseleave
18191818
|| (self.__options.triggerClose.touchleave && env.hasTouchCapability)
18201819
) {
@@ -3148,12 +3147,14 @@ Ruler.prototype = {
31483147

31493148
this.__forceRedraw();
31503149

3151-
var tooltipBrc = this.__$tooltip[0].getBoundingClientRect(),
3150+
var tooltipBcr = this.__$tooltip[0].getBoundingClientRect(),
31523151
result = { size: {
3153-
// brc.width/height are not defined in IE8- but in this
3154-
// case, brc.right/bottom will have the same value
3155-
height: tooltipBrc.bottom,
3156-
width: tooltipBrc.right
3152+
// bcr.width/height are not defined in IE8- but in this
3153+
// case, bcr.right/bottom will have the same value
3154+
// except in iOS 8+ where tooltipBcr.bottom is wrong after scrolling
3155+
// for reasons yet to be determined
3156+
height: tooltipBcr.height || tooltipBcr.bottom,
3157+
width: tooltipBcr.right
31573158
}};
31583159

31593160
if (this.constraints) {
@@ -3170,20 +3171,20 @@ Ruler.prototype = {
31703171

31713172
var $content = this.__$tooltip.find('.tooltipster-content'),
31723173
height = this.__$tooltip.outerHeight(),
3173-
contentBrc = $content[0].getBoundingClientRect(),
3174+
contentBcr = $content[0].getBoundingClientRect(),
31743175
fits = {
31753176
height: height <= this.constraints.height,
31763177
width: (
31773178
// this condition accounts for min-width property that
31783179
// may apply
3179-
tooltipBrc.width <= this.constraints.width
3180+
tooltipBcr.width <= this.constraints.width
31803181
// the -1 is here because scrollWidth actually returns
3181-
// a rounded value, and may be greater than brc.width if
3182+
// a rounded value, and may be greater than bcr.width if
31823183
// it was rounded up. This may cause an issue for contents
31833184
// which actually really overflow by 1px or so, but that
31843185
// should be rare. Not sure how to solve this efficiently.
31853186
// See http://blogs.msdn.com/b/ie/archive/2012/02/17/sub-pixel-rendering-and-the-css-object-model.aspx
3186-
&& contentBrc.width >= $content[0].scrollWidth - 1
3187+
&& contentBcr.width >= $content[0].scrollWidth - 1
31873188
)
31883189
};
31893190

0 commit comments

Comments
 (0)