aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2011-12-23 09:53:05 -0600
committerkborchers <kris.borchers@gmail.com>2011-12-23 09:53:05 -0600
commitbd7bd936d1e437ee1154ab6b7b1cdc70b1018363 (patch)
tree585aaf2d1e9e0e9a189bb6621e18f6c4503914e2 /ui
parent3025c51821b3e1d2307cbc56f308de0fbd4f2dad (diff)
parentf0007ec74526979837c93be13bf181b3cf57c2ce (diff)
downloadjquery-ui-bd7bd936d1e437ee1154ab6b7b1cdc70b1018363.tar.gz
jquery-ui-bd7bd936d1e437ee1154ab6b7b1cdc70b1018363.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.autocomplete.js4
-rw-r--r--ui/jquery.ui.dialog.js17
-rw-r--r--ui/jquery.ui.menu.js38
3 files changed, 36 insertions, 23 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index bd415aa2b..c054ba2dd 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -473,8 +473,8 @@ $.widget( "ui.autocomplete", {
this.search( null, event );
return;
}
- if ( this.menu.first() && /^previous/.test(direction) ||
- this.menu.last() && /^next/.test(direction) ) {
+ if ( this.menu.isFirstItem() && /^previous/.test(direction) ||
+ this.menu.isLastItem() && /^next/.test(direction) ) {
this._value( this.term );
this.menu.blur();
return;
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 3d7638667..1f959a837 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -77,8 +77,11 @@ $.widget("ui.dialog", {
// #5742 - .attr() might return a DOMElement
if ( typeof this.originalTitle !== "string" ) {
this.originalTitle = "";
- }
-
+ }
+ this.oldPosition = {
+ parent: this.element.parent(),
+ index: this.element.parent().children().index( this.element )
+ };
this.options.title = this.options.title || this.originalTitle;
var self = this,
options = self.options,
@@ -168,7 +171,8 @@ $.widget("ui.dialog", {
},
_destroy: function() {
- var self = this;
+ var self = this, next,
+ oldPosition = this.oldPosition;
if ( self.overlay ) {
self.overlay.destroy();
@@ -183,6 +187,13 @@ $.widget("ui.dialog", {
if ( self.originalTitle ) {
self.element.attr( "title", self.originalTitle );
}
+
+ next = oldPosition.parent.children().eq( oldPosition.index );
+ if ( next.length ) {
+ next.before( self.element );
+ } else {
+ oldPosition.parent.append( self.element );
+ }
},
widget: function() {
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index b73018a19..4fac02d2a 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -18,7 +18,7 @@ var idIncrement = 0;
$.widget( "ui.menu", {
version: "@VERSION",
defaultElement: "<ul>",
- delay: 150,
+ delay: 300,
options: {
menus: "ul",
position: {
@@ -332,12 +332,12 @@ $.widget( "ui.menu", {
},
blur: function( event ) {
+ clearTimeout( this.timer );
+
if ( !this.active ) {
return;
}
- clearTimeout( this.timer );
-
this.active.children( "a" ).removeClass( "ui-state-focus" );
this.active = null;
@@ -381,20 +381,22 @@ $.widget( "ui.menu", {
},
collapseAll: function( event, all ) {
+ clearTimeout( this.timer );
+ this.timer = this._delay( function() {
+ // if we were passed an event, look for the submenu that contains the event
+ var currentMenu = all ? this.element :
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
- // if we were passed an event, look for the submenu that contains the event
- var currentMenu = all ? this.element :
- $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
-
- // if we found no valid submenu ancestor, use the main menu to close all sub menus anyway
- if ( !currentMenu.length ) {
- currentMenu = this.element;
- }
+ // if we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+ if ( !currentMenu.length ) {
+ currentMenu = this.element;
+ }
- this._close( currentMenu );
+ this._close( currentMenu );
- this.blur( event );
- this.activeMenu = currentMenu;
+ this.blur( event );
+ this.activeMenu = currentMenu;
+ }, this.delay);
},
// With no arguments, closes the currently active menu - if nothing is active
@@ -445,11 +447,11 @@ $.widget( "ui.menu", {
this._move( "prev", "last", event );
},
- first: function() {
+ isFirstItem: function() {
return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
},
- last: function() {
+ isLastItem: function() {
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
},
@@ -478,7 +480,7 @@ $.widget( "ui.menu", {
this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
return;
}
- if ( this.last() ) {
+ if ( this.isLastItem() ) {
return;
}
if ( this._hasScroll() ) {
@@ -502,7 +504,7 @@ $.widget( "ui.menu", {
this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
return;
}
- if ( this.first() ) {
+ if ( this.isFirstItem() ) {
return;
}
if ( this._hasScroll() ) {