Skip to content
Permalink
Browse files

Tooltip: Check type on event directly, preventing TypeError when prog…

…rammatically moving focus to track-toolipped-input. Fixes #8747 - Tooltip: Using the track option within dialogs creates JS errors
  • Loading branch information
jzaefferer committed Nov 5, 2012
1 parent 8b3e570 commit 98173a3d0ea8e2e6aeb19dda9b232cb65a0684e4
Showing with 9 additions and 1 deletion.
  1. +8 −0 tests/unit/tooltip/tooltip_options.js
  2. +1 −1 ui/jquery.ui.tooltip.js
@@ -146,4 +146,12 @@ test( "track + show delay", function() {
equal( $( ".ui-tooltip" ).css( "top" ), topVal + offsetVal + "px" );
});

test( "track and programmatic focus", function() {
expect( 1 );
$( "#qunit-fixture div input" ).tooltip({
track: true
}).focus();
equal( "inputtitle", $( ".ui-tooltip" ).text() );
});

}( jQuery ) );
@@ -252,7 +252,7 @@ $.widget( "ui.tooltip", {
}
tooltip.position( positionOption );
}
if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
if ( this.options.track && event && /^mouse/.test( event.type ) ) {
this._on( this.document, {
mousemove: position
});

0 comments on commit 98173a3

Please sign in to comment.
You can’t perform that action at this time.