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

(cherry picked from commit 98173a3)
  • Loading branch information...
1 parent 9e0071f commit 241c10044d8dadf186a8c29113a954580a44dec8 @jzaefferer jzaefferer committed with scottgonzalez Nov 5, 2012
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 ) );
View
@@ -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 241c100

Please sign in to comment.