Skip to content

Commit

Permalink
Tooltip: Check type on event directly, preventing TypeError when prog…
Browse files Browse the repository at this point in the history
…rammatically moving focus to track-toolipped-input. Fixes #8747 - Tooltip: Using the track option within dialogs creates JS errors

(cherry picked from commit 98173a3)
  • Loading branch information
jzaefferer authored and scottgonzalez committed Nov 8, 2012
1 parent 9e0071f commit 241c100
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/unit/tooltip/tooltip_options.js
Expand Up @@ -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 ) );
2 changes: 1 addition & 1 deletion ui/jquery.ui.tooltip.js
Expand Up @@ -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
});
Expand Down

0 comments on commit 241c100

Please sign in to comment.