Skip to content

Commit 8fc6ee6

Browse files
committed
Tooltip: Coding standards.
1 parent 9e4576b commit 8fc6ee6

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

ui/jquery.ui.tooltip.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,20 @@ $.widget( "ui.tooltip", {
5050
},
5151

5252
open: function( event ) {
53-
var target = $( event ? event.target : this.element ).closest( this.options.items );
53+
var content,
54+
that = this,
55+
target = $( event ? event.target : this.element )
56+
.closest( this.options.items );
57+
5458
if ( !target.length ) {
5559
return;
5660
}
5761

58-
var that = this;
5962
if ( !target.data( "tooltip-title" ) ) {
6063
target.data( "tooltip-title", target.attr( "title" ) );
6164
}
62-
var content = this.options.content.call( target[0], function( response ) {
65+
66+
content = this.options.content.call( target[0], function( response ) {
6367
// IE may instantly serve a cached response for ajax requests
6468
// delay this call to _open so the other call to _open runs first
6569
setTimeout(function() {
@@ -112,14 +116,15 @@ $.widget( "ui.tooltip", {
112116

113117
close: function( event ) {
114118
var that = this,
115-
target = $( event ? event.currentTarget : this.element );
119+
target = $( event ? event.currentTarget : this.element ),
120+
tooltip = this._find( target );
121+
116122
target.attr( "title", target.data( "tooltip-title" ) );
117123

118124
if ( this.options.disabled ) {
119125
return;
120126
}
121127

122-
var tooltip = this._find( target );
123128
target.removeAttr( "aria-describedby" );
124129

125130
tooltip.stop( true );
@@ -136,12 +141,12 @@ $.widget( "ui.tooltip", {
136141
_tooltip: function() {
137142
var id = "ui-tooltip-" + increments++,
138143
tooltip = $( "<div>" )
139-
.attr({
140-
id: id,
141-
role: "tooltip"
142-
})
143-
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
144-
( this.options.tooltipClass || "" ) );
144+
.attr({
145+
id: id,
146+
role: "tooltip"
147+
})
148+
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
149+
( this.options.tooltipClass || "" ) );
145150
$( "<div>" )
146151
.addClass( "ui-tooltip-content" )
147152
.appendTo( tooltip );

0 commit comments

Comments
 (0)