mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Tooltip: Coding standards.
This commit is contained in:
parent
9e4576bca9
commit
8fc6ee6a19
27
ui/jquery.ui.tooltip.js
vendored
27
ui/jquery.ui.tooltip.js
vendored
@ -50,16 +50,20 @@ $.widget( "ui.tooltip", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
open: function( event ) {
|
open: function( event ) {
|
||||||
var target = $( event ? event.target : this.element ).closest( this.options.items );
|
var content,
|
||||||
|
that = this,
|
||||||
|
target = $( event ? event.target : this.element )
|
||||||
|
.closest( this.options.items );
|
||||||
|
|
||||||
if ( !target.length ) {
|
if ( !target.length ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var that = this;
|
|
||||||
if ( !target.data( "tooltip-title" ) ) {
|
if ( !target.data( "tooltip-title" ) ) {
|
||||||
target.data( "tooltip-title", target.attr( "title" ) );
|
target.data( "tooltip-title", target.attr( "title" ) );
|
||||||
}
|
}
|
||||||
var content = this.options.content.call( target[0], function( response ) {
|
|
||||||
|
content = this.options.content.call( target[0], function( response ) {
|
||||||
// IE may instantly serve a cached response for ajax requests
|
// IE may instantly serve a cached response for ajax requests
|
||||||
// delay this call to _open so the other call to _open runs first
|
// delay this call to _open so the other call to _open runs first
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -112,14 +116,15 @@ $.widget( "ui.tooltip", {
|
|||||||
|
|
||||||
close: function( event ) {
|
close: function( event ) {
|
||||||
var that = this,
|
var that = this,
|
||||||
target = $( event ? event.currentTarget : this.element );
|
target = $( event ? event.currentTarget : this.element ),
|
||||||
|
tooltip = this._find( target );
|
||||||
|
|
||||||
target.attr( "title", target.data( "tooltip-title" ) );
|
target.attr( "title", target.data( "tooltip-title" ) );
|
||||||
|
|
||||||
if ( this.options.disabled ) {
|
if ( this.options.disabled ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltip = this._find( target );
|
|
||||||
target.removeAttr( "aria-describedby" );
|
target.removeAttr( "aria-describedby" );
|
||||||
|
|
||||||
tooltip.stop( true );
|
tooltip.stop( true );
|
||||||
@ -136,12 +141,12 @@ $.widget( "ui.tooltip", {
|
|||||||
_tooltip: function() {
|
_tooltip: function() {
|
||||||
var id = "ui-tooltip-" + increments++,
|
var id = "ui-tooltip-" + increments++,
|
||||||
tooltip = $( "<div>" )
|
tooltip = $( "<div>" )
|
||||||
.attr({
|
.attr({
|
||||||
id: id,
|
id: id,
|
||||||
role: "tooltip"
|
role: "tooltip"
|
||||||
})
|
})
|
||||||
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
|
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
|
||||||
( this.options.tooltipClass || "" ) );
|
( this.options.tooltipClass || "" ) );
|
||||||
$( "<div>" )
|
$( "<div>" )
|
||||||
.addClass( "ui-tooltip-content" )
|
.addClass( "ui-tooltip-content" )
|
||||||
.appendTo( tooltip );
|
.appendTo( tooltip );
|
||||||
|
Loading…
Reference in New Issue
Block a user