Permalink
Browse files

Ensure tooltip is rendered before checking offsetWidth

  • Loading branch information...
1 parent 993e010 commit b4e765215b302856df2cee86593de8be426968c0 @Craga89 Craga89 committed Apr 10, 2012
Showing with 18 additions and 18 deletions.
  1. +5 −5 dist/jquery.qtip.basic.js
  2. +1 −1 dist/jquery.qtip.css
  3. +5 −5 dist/jquery.qtip.js
  4. +3 −3 dist/jquery.qtip.min.js
  5. +4 −4 src/core.js
View
@@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
-* Date: Mon Apr 9 16:30:10 2012 +0100
+* Date: Mon Apr 9 17:49:18 2012 +0100
*/
/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
@@ -509,7 +509,7 @@ function QTip(target, options, id, attr)
}
function repositionMethod(event) {
- if(tooltip[0].offsetWidth > 0) { self.reposition(event); }
+ if(self.rendered && tooltip[0].offsetWidth > 0) { self.reposition(event); }
}
// On mouseenter/mouseleave...
@@ -558,7 +558,7 @@ function QTip(target, options, id, attr)
if(('' + options.hide.event).indexOf('unfocus') > -1) {
posOptions.container.closest('html').bind('mousedown'+namespace, function(event) {
var elem = $(event.target),
- enabled = !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0,
+ enabled = self.rendered && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0,
isAncestor = elem.parents(selector).filter(tooltip[0]).length > 0;
if(elem[0] !== target[0] && elem[0] !== tooltip[0] && !isAncestor &&
@@ -646,7 +646,7 @@ function QTip(target, options, id, attr)
// Update tooltip position on mousemove
targets.document.bind('mousemove'+namespace, function(event) {
// Update the tooltip position only if the tooltip is visible and adjustment is enabled
- if(cache.onTarget && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0) {
+ if(self.rendered && cache.onTarget && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0) {
self.reposition(event || MOUSE);
}
});
@@ -936,7 +936,7 @@ function QTip(target, options, id, attr)
isPositioning = isDrawing = 1; $.each(option, callback); isPositioning = isDrawing = 0;
// Update position / redraw if needed
- if(tooltip[0].offsetWidth > 0 && self.rendered) {
+ if(self.rendered && tooltip[0].offsetWidth > 0) {
if(reposition) {
self.reposition( options.position.target === 'mouse' ? NULL : cache.event );
}
View
@@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
-* Date: Mon Apr 9 16:30:10 2012 +0100
+* Date: Mon Apr 9 17:49:18 2012 +0100
*/
/* Core qTip styles */
View
@@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
-* Date: Mon Apr 9 16:30:10 2012 +0100
+* Date: Mon Apr 9 17:49:18 2012 +0100
*/
/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
@@ -509,7 +509,7 @@ function QTip(target, options, id, attr)
}
function repositionMethod(event) {
- if(tooltip[0].offsetWidth > 0) { self.reposition(event); }
+ if(self.rendered && tooltip[0].offsetWidth > 0) { self.reposition(event); }
}
// On mouseenter/mouseleave...
@@ -558,7 +558,7 @@ function QTip(target, options, id, attr)
if(('' + options.hide.event).indexOf('unfocus') > -1) {
posOptions.container.closest('html').bind('mousedown'+namespace, function(event) {
var elem = $(event.target),
- enabled = !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0,
+ enabled = self.rendered && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0,
isAncestor = elem.parents(selector).filter(tooltip[0]).length > 0;
if(elem[0] !== target[0] && elem[0] !== tooltip[0] && !isAncestor &&
@@ -646,7 +646,7 @@ function QTip(target, options, id, attr)
// Update tooltip position on mousemove
targets.document.bind('mousemove'+namespace, function(event) {
// Update the tooltip position only if the tooltip is visible and adjustment is enabled
- if(cache.onTarget && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0) {
+ if(self.rendered && cache.onTarget && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0) {
self.reposition(event || MOUSE);
}
});
@@ -936,7 +936,7 @@ function QTip(target, options, id, attr)
isPositioning = isDrawing = 1; $.each(option, callback); isPositioning = isDrawing = 0;
// Update position / redraw if needed
- if(tooltip[0].offsetWidth > 0 && self.rendered) {
+ if(self.rendered && tooltip[0].offsetWidth > 0) {
if(reposition) {
self.reposition( options.position.target === 'mouse' ? NULL : cache.event );
}
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -437,7 +437,7 @@ function QTip(target, options, id, attr)
}
function repositionMethod(event) {
- if(tooltip[0].offsetWidth > 0) { self.reposition(event); }
+ if(self.rendered && tooltip[0].offsetWidth > 0) { self.reposition(event); }
}
// On mouseenter/mouseleave...
@@ -486,7 +486,7 @@ function QTip(target, options, id, attr)
if(('' + options.hide.event).indexOf('unfocus') > -1) {
posOptions.container.closest('html').bind('mousedown'+namespace, function(event) {
var elem = $(event.target),
- enabled = !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0,
+ enabled = self.rendered && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0,
isAncestor = elem.parents(selector).filter(tooltip[0]).length > 0;
if(elem[0] !== target[0] && elem[0] !== tooltip[0] && !isAncestor &&
@@ -574,7 +574,7 @@ function QTip(target, options, id, attr)
// Update tooltip position on mousemove
targets.document.bind('mousemove'+namespace, function(event) {
// Update the tooltip position only if the tooltip is visible and adjustment is enabled
- if(cache.onTarget && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0) {
+ if(self.rendered && cache.onTarget && !tooltip.hasClass(disabled) && tooltip[0].offsetWidth > 0) {
self.reposition(event || MOUSE);
}
});
@@ -864,7 +864,7 @@ function QTip(target, options, id, attr)
isPositioning = isDrawing = 1; $.each(option, callback); isPositioning = isDrawing = 0;
// Update position / redraw if needed
- if(tooltip[0].offsetWidth > 0 && self.rendered) {
+ if(self.rendered && tooltip[0].offsetWidth > 0) {
if(reposition) {
self.reposition( options.position.target === 'mouse' ? NULL : cache.event );
}

0 comments on commit b4e7652

Please sign in to comment.