Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Make sure child elements of a tooltip target don't trigger an unfocus…
Browse files Browse the repository at this point in the history
… call
  • Loading branch information
Craga89 committed Feb 7, 2012
1 parent 41e9a84 commit df63eaa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
10 changes: 7 additions & 3 deletions dist/jquery.qtip.basic.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Tue Jan 31 18:16:37 2012 +0000
* Date: Mon Feb 6 19:01:26 2012 +0000
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -552,7 +552,9 @@ function QTip(target, options, id, attr)
var $target = $(event.target),
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');

if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 && $target.add(target).length > 1 && !$target.attr('disabled')) {
if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 &&
!$target.closest(target).length && !$target.attr('disabled')
) {
self.hide(event);
}
});
Expand Down Expand Up @@ -1803,7 +1805,9 @@ PLUGINS = QTIP.plugins = {
pos.top -= coffset.top + (parseInt(parent.css('borderTopWidth'), 10) || 0);

overflow = parent.css('overflow');
if(overflow === 'scroll' || overflow === 'auto') { deep++; }
if(overflow === 'scroll' || overflow === 'auto') {
scroll(parent, 1); deep++;
}
}

if(parent[0] === docBody) { break; }
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.qtip.css
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Tue Jan 31 18:16:37 2012 +0000
* Date: Mon Feb 6 19:01:26 2012 +0000
*/

/* Core qTip styles */
Expand Down
10 changes: 7 additions & 3 deletions dist/jquery.qtip.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Tue Jan 31 18:16:37 2012 +0000
* Date: Mon Feb 6 19:01:26 2012 +0000
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -552,7 +552,9 @@ function QTip(target, options, id, attr)
var $target = $(event.target),
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');

if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 && $target.add(target).length > 1 && !$target.attr('disabled')) {
if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 &&
!$target.closest(target).length && !$target.attr('disabled')
) {
self.hide(event);
}
});
Expand Down Expand Up @@ -1803,7 +1805,9 @@ PLUGINS = QTIP.plugins = {
pos.top -= coffset.top + (parseInt(parent.css('borderTopWidth'), 10) || 0);

overflow = parent.css('overflow');
if(overflow === 'scroll' || overflow === 'auto') { deep++; }
if(overflow === 'scroll' || overflow === 'auto') {
scroll(parent, 1); deep++;
}
}

if(parent[0] === docBody) { break; }
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.qtip.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/core.js
Expand Up @@ -489,7 +489,9 @@ function QTip(target, options, id, attr)
var $target = $(event.target),
enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');

if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 && $target.add(target).length > 1 && !$target.attr('disabled')) {
if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 &&
!$target.closest(target).length && !$target.attr('disabled')
) {
self.hide(event);
}
});
Expand Down Expand Up @@ -1740,7 +1742,9 @@ PLUGINS = QTIP.plugins = {
pos.top -= coffset.top + (parseInt(parent.css('borderTopWidth'), 10) || 0);

overflow = parent.css('overflow');
if(overflow === 'scroll' || overflow === 'auto') { deep++; }
if(overflow === 'scroll' || overflow === 'auto') {
scroll(parent, 1); deep++;
}
}

if(parent[0] === docBody) { break; }
Expand Down

0 comments on commit df63eaa

Please sign in to comment.