aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/i18n/jquery.ui.datepicker-hu.js12
-rw-r--r--ui/jquery.ui.autocomplete.js5
-rw-r--r--ui/jquery.ui.button.js6
-rw-r--r--ui/jquery.ui.datepicker.js29
-rw-r--r--ui/jquery.ui.dialog.js2
-rw-r--r--ui/jquery.ui.menu.js330
-rw-r--r--ui/jquery.ui.popup.js48
-rw-r--r--ui/jquery.ui.position.js4
-rw-r--r--ui/jquery.ui.spinner.js85
-rw-r--r--ui/jquery.ui.tabs.js9
-rw-r--r--ui/jquery.ui.tooltip.js2
-rw-r--r--ui/jquery.ui.widget.js13
12 files changed, 303 insertions, 242 deletions
diff --git a/ui/i18n/jquery.ui.datepicker-hu.js b/ui/i18n/jquery.ui.datepicker-hu.js
index 2eea8b240..b28c268c1 100644
--- a/ui/i18n/jquery.ui.datepicker-hu.js
+++ b/ui/i18n/jquery.ui.datepicker-hu.js
@@ -2,19 +2,19 @@
/* Written by Istvan Karaszi (jquery@spam.raszi.hu). */
jQuery(function($){
$.datepicker.regional['hu'] = {
- closeText: 'bezárás',
- prevText: '« vissza',
- nextText: 'előre »',
+ closeText: 'bezár',
+ prevText: 'vissza',
+ nextText: 'előre',
currentText: 'ma',
monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június',
'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún',
'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],
- dayNames: ['Vasárnap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
+ dayNames: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
- weekHeader: 'Hé',
- dateFormat: 'yy-mm-dd',
+ weekHeader: 'Hét',
+ dateFormat: 'yy.mm.dd.',
firstDay: 1,
isRTL: false,
showMonthAfterYear: true,
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 3e0163682..a4bc82d28 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -51,7 +51,7 @@ $.widget( "ui.autocomplete", {
suppressKeyPress,
suppressInput;
- this.valueMethod = this.element[ this.element.is( "input" ) ? "val" : "text" ];
+ this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
this.element
.addClass( "ui-autocomplete-input" )
@@ -325,6 +325,7 @@ $.widget( "ui.autocomplete", {
_searchTimeout: function( event ) {
var self = this;
+ clearTimeout( self.searching );
self.searching = setTimeout(function() {
// only search if the value has changed
if ( self.term != self.element.val() ) {
@@ -384,7 +385,7 @@ $.widget( "ui.autocomplete", {
this._trigger( "close", event );
}
},
-
+
_change: function( event ) {
if ( this.previous !== this._value() ) {
this._trigger( "change", event, { item: this.selectedItem } );
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index 89c52d007..1d9393d37 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -379,7 +379,7 @@ $.widget( "ui.buttonset", {
},
refresh: function() {
- var ltr = this.element.css( "direction" ) === "ltr";
+ var rtl = this.element.css( "direction" ) === "rtl";
this.buttons = this.element.find( this.options.items )
.filter( ":ui-button" )
@@ -393,10 +393,10 @@ $.widget( "ui.buttonset", {
})
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
.filter( ":first" )
- .addClass( ltr ? "ui-corner-left" : "ui-corner-right" )
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
.end()
.filter( ":last" )
- .addClass( ltr ? "ui-corner-right" : "ui-corner-left" )
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
.end()
.end();
},
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 0b6fb2218..e09dc5a50 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -636,10 +636,10 @@ $.extend(Datepicker.prototype, {
return;
var inst = $.datepicker._getInst(input);
if ($.datepicker._curInst && $.datepicker._curInst != inst) {
- if ( $.datepicker._datepickerShowing ) {
- $.datepicker._triggerOnClose($.datepicker._curInst);
- }
$.datepicker._curInst.dpDiv.stop(true, true);
+ if ( inst && $.datepicker._datepickerShowing ) {
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+ }
}
var beforeShow = $.datepicker._get(inst, 'beforeShow');
var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
@@ -790,14 +790,6 @@ $.extend(Datepicker.prototype, {
return [position.left, position.top];
},
- /* Trigger custom callback of onClose. */
- _triggerOnClose: function(inst) {
- var onClose = this._get(inst, 'onClose');
- if (onClose)
- onClose.apply((inst.input ? inst.input[0] : null),
- [(inst.input ? inst.input.val() : ''), inst]);
- },
-
/* Hide the date picker from view.
@param input element - the input field attached to the date picker */
_hideDatepicker: function(input) {
@@ -820,8 +812,11 @@ $.extend(Datepicker.prototype, {
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
if (!showAnim)
postProcess();
- $.datepicker._triggerOnClose(inst);
this._datepickerShowing = false;
+ var onClose = this._get(inst, 'onClose');
+ if (onClose)
+ onClose.apply((inst.input ? inst.input[0] : null),
+ [(inst.input ? inst.input.val() : ''), inst]);
this._lastInput = null;
if (this._inDialog) {
this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
@@ -843,12 +838,16 @@ $.extend(Datepicker.prototype, {
_checkExternalClick: function(event) {
if (!$.datepicker._curInst)
return;
- var $target = $(event.target);
- if ($target[0].id != $.datepicker._mainDivId &&
+
+ var $target = $(event.target),
+ inst = $.datepicker._getInst($target[0]);
+
+ if ( ( ( $target[0].id != $.datepicker._mainDivId &&
$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.hasClass($.datepicker._triggerClass) &&
- $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
$.datepicker._hideDatepicker();
},
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 493ed07e6..065d640fb 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -293,7 +293,7 @@ $.widget("ui.dialog", {
// prevent tabbing out of modal dialogs
if ( options.modal ) {
- uiDialog.bind( "keypress.ui-dialog", function( event ) {
+ uiDialog.bind( "keydown.ui-dialog", function( event ) {
if ( event.keyCode !== $.ui.keyCode.TAB ) {
return;
}
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 27e76d909..6d9db8879 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -20,13 +20,13 @@ $.widget( "ui.menu", {
defaultElement: "<ul>",
delay: 150,
options: {
+ items: "ul",
position: {
my: "left top",
at: "right top"
}
},
_create: function() {
- var self = this;
this.activeMenu = this.element;
this.menuId = this.element.attr( "id" ) || "ui-menu-" + idIncrement++;
if ( this.element.find( ".ui-icon" ).length ) {
@@ -40,11 +40,11 @@ $.widget( "ui.menu", {
})
// need to catch all clicks on disabled menu
// not possible through _bind
- .bind( "click.menu", function( event ) {
- if ( self.options.disabled ) {
+ .bind( "click.menu", $.proxy( function( event ) {
+ if ( this.options.disabled ) {
event.preventDefault();
}
- });
+ }, this));
this._bind({
"click .ui-menu-item:has(a)": function( event ) {
event.stopImmediatePropagation();
@@ -62,120 +62,128 @@ $.widget( "ui.menu", {
target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
this.focus( event, target );
},
+ "mouseleave": "collapseAll",
+ "mouseleave .ui-menu": "collapseAll",
"mouseout .ui-menu-item": "blur",
"focus": function( event ) {
this.focus( event, $( event.target ).children( ".ui-menu-item:first" ) );
},
- "blur": "collapseAll"
+ blur: function( event ) {
+ this._delay( function() {
+ if ( ! $.contains( this.element[0], document.activeElement ) ) {
+ this.collapseAll( event );
+ }
+ }, 0);
+ }
});
this.refresh();
- this.element.attr( "tabIndex", 0 ).bind( "keydown.menu", function( event ) {
- if ( self.options.disabled ) {
- return;
- }
- switch ( event.keyCode ) {
- case $.ui.keyCode.PAGE_UP:
- self.previousPage( event );
- event.preventDefault();
- event.stopImmediatePropagation();
- break;
- case $.ui.keyCode.PAGE_DOWN:
- self.nextPage( event );
- event.preventDefault();
- event.stopImmediatePropagation();
- break;
- case $.ui.keyCode.HOME:
- self._move( "first", "first", event );
- event.preventDefault();
- event.stopImmediatePropagation();
- break;
- case $.ui.keyCode.END:
- self._move( "last", "last", event );
- event.preventDefault();
- event.stopImmediatePropagation();
- break;
- case $.ui.keyCode.UP:
- self.previous( event );
- event.preventDefault();
- event.stopImmediatePropagation();
- break;
- case $.ui.keyCode.DOWN:
- self.next( event );
- event.preventDefault();
- event.stopImmediatePropagation();
- break;
- case $.ui.keyCode.LEFT:
- if (self.collapse( event )) {
+ this.element.attr( "tabIndex", 0 );
+ this._bind({
+ "keydown": function( event ) {
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.PAGE_UP:
+ this.previousPage( event );
+ event.preventDefault();
event.stopImmediatePropagation();
- }
- event.preventDefault();
- break;
- case $.ui.keyCode.RIGHT:
- if (self.expand( event )) {
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ this.nextPage( event );
+ event.preventDefault();
event.stopImmediatePropagation();
- }
- event.preventDefault();
- break;
- case $.ui.keyCode.ENTER:
- if ( self.active.children( "a[aria-haspopup='true']" ).length ) {
- if ( self.expand( event ) ) {
- event.stopImmediatePropagation();
- }
- }
- else {
- self.select( event );
+ break;
+ case $.ui.keyCode.HOME:
+ this._move( "first", "first", event );
+ event.preventDefault();
event.stopImmediatePropagation();
- }
- event.preventDefault();
- break;
- case $.ui.keyCode.ESCAPE:
- if ( self.collapse( event ) ) {
+ break;
+ case $.ui.keyCode.END:
+ this._move( "last", "last", event );
+ event.preventDefault();
event.stopImmediatePropagation();
- }
- event.preventDefault();
- break;
- default:
- event.stopPropagation();
- clearTimeout( self.filterTimer );
- var match,
- prev = self.previousFilter || "",
- character = String.fromCharCode( event.keyCode ),
- skip = false;
-
- if (character == prev) {
- skip = true;
- } else {
- character = prev + character;
- }
- function escape( value ) {
- return value.replace( /[-[\]{}()*+?.,\\^$|#\s]/g , "\\$&" );
- }
- match = self.activeMenu.children( ".ui-menu-item" ).filter( function() {
- return new RegExp("^" + escape(character), "i")
- .test( $( this ).children( "a" ).text() );
- });
- match = skip && match.index(self.active.next()) != -1 ? self.active.nextAll(".ui-menu-item") : match;
- if ( !match.length ) {
- character = String.fromCharCode(event.keyCode);
- match = self.activeMenu.children(".ui-menu-item").filter( function() {
+ break;
+ case $.ui.keyCode.UP:
+ this.previous( event );
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ break;
+ case $.ui.keyCode.DOWN:
+ this.next( event );
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ break;
+ case $.ui.keyCode.LEFT:
+ if (this.collapse( event )) {
+ event.stopImmediatePropagation();
+ }
+ event.preventDefault();
+ break;
+ case $.ui.keyCode.RIGHT:
+ if (this.expand( event )) {
+ event.stopImmediatePropagation();
+ }
+ event.preventDefault();
+ break;
+ case $.ui.keyCode.ENTER:
+ if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
+ if ( this.expand( event ) ) {
+ event.stopImmediatePropagation();
+ }
+ }
+ else {
+ this.select( event );
+ event.stopImmediatePropagation();
+ }
+ event.preventDefault();
+ break;
+ case $.ui.keyCode.ESCAPE:
+ if ( this.collapse( event ) ) {
+ event.stopImmediatePropagation();
+ }
+ event.preventDefault();
+ break;
+ default:
+ event.stopPropagation();
+ clearTimeout( this.filterTimer );
+ var match,
+ prev = this.previousFilter || "",
+ character = String.fromCharCode( event.keyCode ),
+ skip = false;
+
+ if (character == prev) {
+ skip = true;
+ } else {
+ character = prev + character;
+ }
+ function escape( value ) {
+ return value.replace( /[-[\]{}()*+?.,\\^$|#\s]/g , "\\$&" );
+ }
+ match = this.activeMenu.children( ".ui-menu-item" ).filter( function() {
return new RegExp("^" + escape(character), "i")
.test( $( this ).children( "a" ).text() );
});
- }
- if ( match.length ) {
- self.focus( event, match );
- if (match.length > 1) {
- self.previousFilter = character;
- self.filterTimer = setTimeout( function() {
- delete self.previousFilter;
- }, 1000 );
+ match = skip && match.index(this.active.next()) != -1 ? this.active.nextAll(".ui-menu-item") : match;
+ if ( !match.length ) {
+ character = String.fromCharCode(event.keyCode);
+ match = this.activeMenu.children(".ui-menu-item").filter( function() {
+ return new RegExp("^" + escape(character), "i")
+ .test( $( this ).children( "a" ).text() );
+ });
+ }
+ if ( match.length ) {
+ this.focus( event, match );
+ if (match.length > 1) {
+ this.previousFilter = character;
+ this.filterTimer = this._delay( function() {
+ delete this.previousFilter;
+ }, 1000 );
+ } else {
+ delete this.previousFilter;
+ }
} else {
- delete self.previousFilter;
+ delete this.previousFilter;
}
- } else {
- delete self.previousFilter;
}
}
});
@@ -193,7 +201,7 @@ $.widget( "ui.menu", {
//destroy (sub)menus
this.element
.removeAttr( "aria-activedescendant" )
- .find( "ul" )
+ .find( ".ui-menu" )
.andSelf()
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
@@ -219,43 +227,38 @@ $.widget( "ui.menu", {
},
refresh: function() {
- var self = this,
-
- // initialize nested menus
- submenus = this.element.find( "ul:not(.ui-menu)" )
- .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
- .attr( "role", "menu" )
- .hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" ),
+ // initialize nested menus
+ var submenus = this.element.find( this.options.items + ":not( .ui-menu )" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .attr( "role", "menu" )
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" );
// don't refresh list items that are already adapted
- items = submenus.add( this.element ).children( "li:not(.ui-menu-item):has(a)" )
- .addClass( "ui-menu-item" )
- .attr( "role", "presentation" );
-
- items.children( "a" )
- .addClass( "ui-corner-all" )
- .attr( "tabIndex", -1 )
- .attr( "role", "menuitem" )
- .attr( "id", function( i ) {
- return self.element.attr( "id" ) + "-" + i;
- });
+ var menuId = this.menuId;
+ submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" )
+ .addClass( "ui-menu-item" )
+ .attr( "role", "presentation" )
+ .children( "a" )
+ .addClass( "ui-corner-all" )
+ .attr( "tabIndex", -1 )
+ .attr( "role", "menuitem" )
+ .attr( "id", function( i ) {
+ return menuId + "-" + i;
+ });
submenus.each( function() {
var menu = $( this ),
item = menu.prev( "a" );
item.attr( "aria-haspopup", "true" )
- .prepend( '<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>' );
+ .prepend( '<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>' );
menu.attr( "aria-labelledby", item.attr( "id" ) );
});
},
focus: function( event, item ) {
- var nested,
- self = this;
-
this.blur( event );
if ( this._hasScroll() ) {
@@ -277,18 +280,18 @@ $.widget( "ui.menu", {
.children( "a" )
.addClass( "ui-state-focus" )
.end();
- self.element.attr( "aria-activedescendant", self.active.children("a").attr("id") );
+ this.element.attr( "aria-activedescendant", this.active.children( "a" ).attr( "id" ) );
// highlight active parent menu item, if any
- this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");
+ this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" );
- self.timer = setTimeout( function() {
- self._close();
- }, self.delay );
+ this.timer = this._delay( function() {
+ this._close();
+ }, this.delay );
- nested = $( ">ul", item );
+ var nested = $( "> .ui-menu", item );
if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
- self._startOpening(nested);
+ this._startOpening(nested);
}
this.activeMenu = item.parent();
@@ -317,11 +320,10 @@ $.widget( "ui.menu", {
return;
}
- var self = this;
- self.timer = setTimeout( function() {
- self._close();
- self._open( submenu );
- }, self.delay );
+ this.timer = this._delay( function() {
+ this._close();
+ this._open( submenu );
+ }, this.delay );
},
_open: function( submenu ) {
@@ -345,23 +347,32 @@ $.widget( "ui.menu", {
.position( position );
},
- collapseAll: function( event ) {
- this.element
- .find( "ul" )
- .hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" )
- .end()
- .find( "a.ui-state-active" )
- .removeClass( "ui-state-active" );
+ collapseAll: function( event, all ) {
+
+ // 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;
+ }
+
+ this._close( currentMenu );
this.blur( event );
- this.activeMenu = this.element;
+ this.activeMenu = currentMenu;
},
- _close: function() {
- this.active.parent()
- .find( "ul" )
+ // With no arguments, closes the currently active menu - if nothing is active
+ // it closes all menus. If passed an argument, it will search for menus BELOW
+ _close: function( startMenu ) {
+ if ( !startMenu ) {
+ startMenu = this.active ? this.active.parent() : this.element;
+ }
+
+ startMenu
+ .find( ".ui-menu" )
.hide()
.attr( "aria-hidden", "true" )
.attr( "aria-expanded", "false" )
@@ -371,27 +382,23 @@ $.widget( "ui.menu", {
},
collapse: function( event ) {
- var newItem = this.active && this.active.parents("li:not(.ui-menubar-item)").first();
+ var newItem = this.active && this.active.parent().closest( ".ui-menu-item", this.element );
if ( newItem && newItem.length ) {
- this.active.parent()
- .attr("aria-hidden", "true")
- .attr("aria-expanded", "false")
- .hide();
+ this._close();
this.focus( event, newItem );
return true;
}
},
expand: function( event ) {
- var self = this,
- newItem = this.active && this.active.children("ul").children("li").first();
+ var newItem = this.active && this.active.children( ".ui-menu " ).children( ".ui-menu-item" ).first();
if ( newItem && newItem.length ) {
this._open( newItem.parent() );
//timeout so Firefox will not hide activedescendant change in expanding submenu from AT
- setTimeout( function() {
- self.focus( event, newItem );
+ this._delay( function() {
+ this.focus( event, newItem );
}, 20 );
return true;
}
@@ -487,11 +494,12 @@ $.widget( "ui.menu", {
},
select: function( event ) {
+
// save active reference before collapseAll triggers blur
var ui = {
item: this.active
};
- this.collapseAll( event );
+ this.collapseAll( event, true );
this._trigger( "select", event, ui );
}
});
diff --git a/ui/jquery.ui.popup.js b/ui/jquery.ui.popup.js
index 508209a55..ce7a565db 100644
--- a/ui/jquery.ui.popup.js
+++ b/ui/jquery.ui.popup.js
@@ -22,6 +22,14 @@ $.widget( "ui.popup", {
position: {
my: "left top",
at: "left bottom"
+ },
+ show: {
+ effect: "slideDown",
+ duration: "fast"
+ },
+ hide: {
+ effect: "fadeOut",
+ duration: "fast"
}
},
_create: function() {
@@ -45,13 +53,14 @@ $.widget( "ui.popup", {
.attr( "aria-owns", this.element.attr( "id" ) );
this.element
- .addClass( "ui-popup" )
- this.close();
+ .addClass( "ui-popup" );
+ this._beforeClose();
+ this.element.hide();
this._bind(this.options.trigger, {
keydown: function( event ) {
// prevent space-to-open to scroll the page, only happens for anchor ui.button
- if ( this.options.trigger.is( "a:ui-button" ) && event.keyCode == $.ui.keyCode.SPACE ) {
+ if ( $.ui.button && this.options.trigger.is( "a:ui-button" ) && event.keyCode == $.ui.keyCode.SPACE ) {
event.preventDefault();
}
// TODO handle SPACE to open popup? only when not handled by ui.button
@@ -72,16 +81,15 @@ $.widget( "ui.popup", {
// let it propagate to close
return;
}
- var that = this;
clearTimeout( this.closeTimer );
- setTimeout(function() {
- that.open( event );
+ this._delay(function() {
+ this.open( event );
}, 1);
}
});
- if ( !this.element.is( ":ui-menu" ) ) {
- //default use case, wrap tab order in popup
+ if ( !$.ui.menu || !this.element.is( ":ui-menu" ) ) {
+ // default use case, wrap tab order in popup
this._bind({ keydown : function( event ) {
if ( event.keyCode !== $.ui.keyCode.TAB ) {
return;
@@ -102,11 +110,10 @@ $.widget( "ui.popup", {
this._bind({
focusout: function( event ) {
- var that = this;
// use a timer to allow click to clear it and letting that
// handle the closing instead of opening again
- that.closeTimer = setTimeout( function() {
- that.close( event );
+ this.closeTimer = this._delay( function() {
+ this.close( event );
}, 100);
},
focusin: function( event ) {
@@ -133,7 +140,7 @@ $.widget( "ui.popup", {
this.close( event );
}
}
- })
+ });
},
_destroy: function() {
@@ -161,13 +168,14 @@ $.widget( "ui.popup", {
of: this.options.trigger
}, this.options.position );
+ this._show( this.element, this.options.show );
this.element
- .show()
.attr( "aria-hidden", "false" )
.attr( "aria-expanded", "true" )
.position( position );
- if (this.element.is( ":ui-menu" )) { //popup is a menu
+ // can't use custom selector when menu isn't loaded
+ if ( $.ui.menu && this.element.is( ":ui-menu" ) ) {
this.element.menu( "focus", event, this.element.children( "li" ).first() );
this.element.focus();
} else {
@@ -192,10 +200,8 @@ $.widget( "ui.popup", {
},
close: function( event ) {
- this.element
- .hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" );
+ this._beforeClose();
+ this._hide( this.element, this.options.hide );
this.options.trigger.attr( "tabindex" , 0 );
if ( this.removeTabIndex ) {
@@ -203,6 +209,12 @@ $.widget( "ui.popup", {
}
this.isOpen = false;
this._trigger( "close", event );
+ },
+
+ _beforeClose: function() {
+ this.element
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" );
}
});
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index 24a033fc2..74530b948 100644
--- a/ui/jquery.ui.position.js
+++ b/ui/jquery.ui.position.js
@@ -376,7 +376,7 @@ $.ui.position = {
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
- if ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) {
+ if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) ) {
data.elem
.addClass( "ui-flipped-bottom" );
@@ -385,7 +385,7 @@ $.ui.position = {
}
else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - withinOffset;
- if ( newOverTop > 0 || Math.abs( newOverTop ) < overBottom ) {
+ if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || Math.abs( newOverTop ) < overBottom ) ) {
data.elem
.addClass( "ui-flipped-top" );
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js
index a5c25cd34..09df97be7 100644
--- a/ui/jquery.ui.spinner.js
+++ b/ui/jquery.ui.spinner.js
@@ -10,6 +10,7 @@
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
+ * jquery.ui.button.js
*/
(function( $ ) {
@@ -30,8 +31,8 @@ $.widget( "ui.spinner", {
widgetEventPrefix: "spin",
options: {
incremental: true,
- max: Number.MAX_VALUE,
- min: -Number.MAX_VALUE,
+ max: null,
+ min: null,
numberFormat: null,
page: 10,
step: 1,
@@ -147,6 +148,12 @@ $.widget( "ui.spinner", {
.button()
.removeClass( "ui-corner-all" );
+ // IE 6 doesn't understand height: 50% for the buttons
+ // unless the wrapper has an explicit height
+ if ( this.buttons.height() === uiSpinner.height() && uiSpinner.height() > 0 ) {
+ uiSpinner.height( uiSpinner.height() );
+ }
+
// disable spinner if element was already disabled
if ( this.options.disabled ) {
this.disable();
@@ -202,56 +209,78 @@ $.widget( "ui.spinner", {
},
_repeat: function( i, steps, event ) {
- var that = this;
i = i || 500;
clearTimeout( this.timer );
- this.timer = setTimeout(function() {
- that._repeat( 40, steps, event );
+ this.timer = this._delay(function() {
+ this._repeat( 40, steps, event );
}, i );
this._spin( steps * this.options.step, event );
},
_spin: function( step, event ) {
+ var value = this.value() || 0;
+
if ( !this.counter ) {
this.counter = 1;
}
- var value = this.value(),
- newVal = value + step * this._increment( this.counter ),
- // fix precision from bad JS floating point math
- precision = Math.max( this._precision( value ),
- this._precision( this.options.step ) );
- // clamp the new value
- newVal = this._trimValue( newVal.toFixed( precision ) );
+ value = this._adjustValue( value + step * this._increment( this.counter ) );
- if ( !this.spinning || this._trigger( "spin", event, { value: newVal } ) !== false) {
- this._value( newVal );
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
+ this._value( value );
this.counter++;
}
},
_increment: function( i ) {
- return this.options.incremental ?
- Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 ) :
- 1;
+ var incremental = this.options.incremental;
+
+ if ( incremental ) {
+ return $.isFunction( incremental ) ?
+ incremental( i ) :
+ Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
+ }
+
+ return 1;
},
- _precision: function( num ) {
+ _precision: function() {
+ var precision = this._precisionOf( this.options.step );
+ if ( this.options.min !== null ) {
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
+ }
+ return precision;
+ },
+
+ _precisionOf: function( num ) {
var str = num.toString(),
decimal = str.indexOf( "." );
return decimal === -1 ? 0 : str.length - decimal - 1;
},
- _trimValue: function( value ) {
- var options = this.options;
+ _adjustValue: function( value ) {
+ var base, aboveMin,
+ options = this.options;
- if ( value > options.max) {
+ // make sure we're at a valid step
+ // - find out where we are relative to the base (min or 0)
+ base = options.min !== null ? options.min : 0;
+ aboveMin = value - base;
+ // - round to the nearest step
+ aboveMin = Math.round(aboveMin / options.step) * options.step;
+ // - rounding is based on 0, so adjust back to our base
+ value = base + aboveMin;
+
+ // fix precision from bad JS floating point math
+ value = parseFloat( value.toFixed( this._precision() ) );
+
+ // clamp the value
+ if ( options.max !== null && value > options.max) {
return options.max;
}
-
- if ( value < options.min ) {
+ if ( options.min !== null && value < options.min ) {
return options.min;
}
@@ -290,10 +319,10 @@ $.widget( "ui.spinner", {
}),
_parse: function( val ) {
- if ( typeof val === "string" ) {
+ if ( typeof val === "string" && val !== "" ) {
val = window.Globalize && this.options.numberFormat ? Globalize.parseFloat( val ) : +val;
}
- return isNaN( val ) ? null : val;
+ return val === "" || isNaN( val ) ? null : val;
},
_format: function( value ) {
@@ -315,13 +344,13 @@ $.widget( "ui.spinner", {
},
// update the value without triggering change
- _value: function( value, ignoreRange ) {
+ _value: function( value, allowAny ) {
var parsed;
if ( value !== "" ) {
parsed = this._parse( value );
if ( parsed !== null ) {
- if ( !ignoreRange ) {
- parsed = this._trimValue( parsed );
+ if ( !allowAny ) {
+ parsed = this._adjustValue( parsed );
}
value = this._format( parsed );
}
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index b6f178ed9..a1bf72cb1 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -25,7 +25,7 @@ var isLocal = (function() {
return function( anchor ) {
// clone the node to work around IE 6 not normalizing the href property
// if it's manually set, i.e., a.href = "#foo" kills the normalization
- anchor = anchor.cloneNode();
+ anchor = anchor.cloneNode( false );
return anchor.hash.length > 1 &&
anchor.href.replace( rhash, "" ) === currentPage;
};
@@ -792,11 +792,14 @@ if ( $.uiBackCompat !== false ) {
index = this._getIndex( index );
var options = this.options,
tab = this.lis.eq( index ).remove(),
- panel = this.panels.eq( index ).remove();
+ panel = this._getPanelForTab( tab.find( "a[aria-controls]" ) ).remove();
// If selected tab was removed focus tab to the right or
// in case the last tab was removed the tab to the left.
- if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 1) {
+ // We check for more than 2 tabs, because if there are only 2,
+ // then when we remove this tab, there will only be one tab left
+ // so we don't need to detect which tab to activate.
+ if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
}
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 5e32459fc..2f8d92969 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -27,7 +27,7 @@ $.widget( "ui.tooltip", {
position: {
my: "left+15 center",
at: "right center",
- collision: "flip fit"
+ collision: "flipfit flipfit"
},
show: true,
tooltipClass: null,
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 5b7942600..31328a455 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -270,9 +270,9 @@ $.Widget.prototype = {
return this;
},
_setOptions: function( options ) {
- var self = this;
+ var that = this;
$.each( options, function( key, value ) {
- self._setOption( key, value );
+ that._setOption( key, value );
});
return this;
@@ -333,6 +333,15 @@ $.Widget.prototype = {
});
},
+ _delay: function( handler, delay ) {
+ function handlerProxy() {
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+ var instance = this;
+ return setTimeout( handlerProxy, delay || 0 );
+ },
+
_hoverable: function( element ) {
this.hoverable = this.hoverable.add( element );
this._bind( element, {