aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-05-28 20:30:14 -0400
committerScott González <scott.gonzalez@gmail.com>2011-05-28 20:30:14 -0400
commit8fc6ee6a19e200cedb324ea34076b0f176964894 (patch)
tree03cf10d0b1c72e5170a2e2326cabac0c5e0e05e0
parent9e4576bca9508d5d01f3fdf518c6b50c0d110ffb (diff)
downloadjquery-ui-8fc6ee6a19e200cedb324ea34076b0f176964894.tar.gz
jquery-ui-8fc6ee6a19e200cedb324ea34076b0f176964894.zip
Tooltip: Coding standards.
-rw-r--r--ui/jquery.ui.tooltip.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 236e95ae8..279db69fa 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -50,16 +50,20 @@ $.widget( "ui.tooltip", {
},
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 ) {
return;
}
- var that = this;
if ( !target.data( "tooltip-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
// delay this call to _open so the other call to _open runs first
setTimeout(function() {
@@ -112,14 +116,15 @@ $.widget( "ui.tooltip", {
close: function( event ) {
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" ) );
if ( this.options.disabled ) {
return;
}
- var tooltip = this._find( target );
target.removeAttr( "aria-describedby" );
tooltip.stop( true );
@@ -136,12 +141,12 @@ $.widget( "ui.tooltip", {
_tooltip: function() {
var id = "ui-tooltip-" + increments++,
tooltip = $( "<div>" )
- .attr({
- id: id,
- role: "tooltip"
- })
- .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
- ( this.options.tooltipClass || "" ) );
+ .attr({
+ id: id,
+ role: "tooltip"
+ })
+ .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
+ ( this.options.tooltipClass || "" ) );
$( "<div>" )
.addClass( "ui-tooltip-content" )
.appendTo( tooltip );