diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-11-05 18:59:52 +0100 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-11-08 17:55:59 -0500 |
commit | 241c10044d8dadf186a8c29113a954580a44dec8 (patch) | |
tree | a905e3ed034555cc115fa09b24f2258a2e828f25 | |
parent | 9e0071fea411902f6daee04bd6e9f0ca83dc5296 (diff) | |
download | jquery-ui-241c10044d8dadf186a8c29113a954580a44dec8.tar.gz jquery-ui-241c10044d8dadf186a8c29113a954580a44dec8.zip |
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
(cherry picked from commit 98173a3d0ea8e2e6aeb19dda9b232cb65a0684e4)
-rw-r--r-- | tests/unit/tooltip/tooltip_options.js | 8 | ||||
-rw-r--r-- | ui/jquery.ui.tooltip.js | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index 9f0de2b57..f9da27fb7 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.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 ) ); diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index e2df1092e..482ce2120 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -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 }); |