Tooltip: Check type on event directly, preventing TypeError when programmatically moving focus to track-toolipped-input. Fixes #8747 - Tooltip: Using the track option within dialogs creates JS errors

This commit is contained in:
Jörn Zaefferer 2012-11-05 18:59:52 +01:00
parent 8b3e570241
commit 98173a3d0e
2 changed files with 9 additions and 1 deletions

View File

@ -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 ) );

View File

@ -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
});