]> source.dussan.org Git - jquery-ui.git/commitdiff
Tooltip: Check type on event directly, preventing TypeError when programmatically...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 5 Nov 2012 17:59:52 +0000 (18:59 +0100)
committerScott González <scott.gonzalez@gmail.com>
Thu, 8 Nov 2012 22:55:59 +0000 (17:55 -0500)
(cherry picked from commit 98173a3d0ea8e2e6aeb19dda9b232cb65a0684e4)

tests/unit/tooltip/tooltip_options.js
ui/jquery.ui.tooltip.js

index 9f0de2b570701e6897b6982a44ccd728d9bc34ab..f9da27fb7431439e11f333d50cb7be124d2ead62 100644 (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 ) );
index e2df1092e0bf1573dfbc891c6ebc43e52a10f8d8..482ce21204163c716d6983e8947878a4a1732b7e 100644 (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
                        });