aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-05-30 18:27:48 -0400
committerScott González <scott.gonzalez@gmail.com>2011-05-30 18:27:48 -0400
commit1b52cefc26da3a3c5bcb9116db79f68dbcc5de81 (patch)
tree4c8aca6129237205a45807e31a8eaf487df96141 /ui
parente5186dc9309cddf4a70bad37de4b4c71d2018f5c (diff)
downloadjquery-ui-1b52cefc26da3a3c5bcb9116db79f68dbcc5de81.tar.gz
jquery-ui-1b52cefc26da3a3c5bcb9116db79f68dbcc5de81.zip
Widget: Fixed _show() and _hide() implementation and added tests.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.tooltip.js8
-rw-r--r--ui/jquery.ui.widget.js18
2 files changed, 22 insertions, 4 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index d30e49c66..a6ccc07bc 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -22,13 +22,19 @@ $.widget( "ui.tooltip", {
content: function() {
return $( this ).attr( "title" );
},
+ hide: true,
items: "[title]",
position: {
my: "left+15 center",
at: "right center",
collision: "flip fit"
},
- tooltipClass: null
+ show: true,
+ tooltipClass: null,
+
+ // callbacks
+ close: null,
+ open: null
},
_create: function() {
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index da52a5a9c..00bc07c4f 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -375,9 +375,20 @@ $.Widget.prototype = {
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+ if ( typeof options === "string" ) {
+ options = { effect: options };
+ }
+ var hasOptions,
+ effectName = !options ?
+ method :
+ options === true || typeof options === "number" ?
+ defaultEffect :
+ options.effect || defaultEffect;
options = options || {};
- var hasOptions = !$.isEmptyObject( options ),
- effectName = options.effect || defaultEffect;
+ if ( typeof options === "number" ) {
+ options = { duration: options };
+ }
+ hasOptions = !$.isEmptyObject( options );
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
@@ -387,11 +398,12 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
- element.queue( function() {
+ element.queue(function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
+ next();
});
}
};