mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tooltip: Check if event exists before checking properties in open(). Fixes #8626 - Programatically opening a tooltip with out giving an event results in a javascript error.
This commit is contained in:
parent
f417a92c54
commit
96f2aa4c72
@ -29,6 +29,23 @@ test( "open/close", function() {
|
|||||||
$.fx.off = false;
|
$.fx.off = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #8626 - Calling open() without an event
|
||||||
|
test( "open/close with tracking", function() {
|
||||||
|
expect( 3 );
|
||||||
|
$.fx.off = true;
|
||||||
|
var tooltip,
|
||||||
|
element = $( "#tooltipped1" ).tooltip({ track: true });
|
||||||
|
equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
||||||
|
|
||||||
|
element.tooltip( "open" );
|
||||||
|
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
|
||||||
|
ok( tooltip.is( ":visible" ) );
|
||||||
|
|
||||||
|
element.tooltip( "close" );
|
||||||
|
ok( tooltip.is( ":hidden" ) );
|
||||||
|
$.fx.off = false;
|
||||||
|
});
|
||||||
|
|
||||||
test( "enable/disable", function() {
|
test( "enable/disable", function() {
|
||||||
expect( 7 );
|
expect( 7 );
|
||||||
$.fx.off = true;
|
$.fx.off = true;
|
||||||
|
2
ui/jquery.ui.tooltip.js
vendored
2
ui/jquery.ui.tooltip.js
vendored
@ -216,7 +216,7 @@ $.widget( "ui.tooltip", {
|
|||||||
positionOption.of = event;
|
positionOption.of = event;
|
||||||
tooltip.position( positionOption );
|
tooltip.position( positionOption );
|
||||||
}
|
}
|
||||||
if ( this.options.track && /^mouse/.test( event.originalEvent.type ) ) {
|
if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
|
||||||
positionOption = $.extend( {}, this.options.position );
|
positionOption = $.extend( {}, this.options.position );
|
||||||
this._on( this.document, {
|
this._on( this.document, {
|
||||||
mousemove: position
|
mousemove: position
|
||||||
|
Loading…
Reference in New Issue
Block a user