diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.effects.blind.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.bounce.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.clip.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.core.js | 35 | ||||
-rw-r--r-- | ui/jquery.effects.drop.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.explode.js | 77 | ||||
-rw-r--r-- | ui/jquery.effects.fade.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.fold.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.highlight.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.pulsate.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.scale.js | 6 | ||||
-rw-r--r-- | ui/jquery.effects.shake.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.slide.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.transfer.js | 2 | ||||
-rw-r--r-- | ui/jquery.ui.accordion.js | 5 | ||||
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 5 | ||||
-rw-r--r-- | ui/jquery.ui.button.js | 18 | ||||
-rw-r--r-- | ui/jquery.ui.datepicker.js | 10 | ||||
-rw-r--r-- | ui/jquery.ui.draggable.js | 2 | ||||
-rw-r--r-- | ui/jquery.ui.menu.js | 37 | ||||
-rw-r--r-- | ui/jquery.ui.widget.js | 2 |
21 files changed, 148 insertions, 71 deletions
diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index 0c865d59f..6b7250789 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.blind = function( o ) { +$.effects.effect.blind = function( o ) { return this.queue( function() { diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js index d5b43492e..8da0feb76 100644 --- a/ui/jquery.effects.bounce.js +++ b/ui/jquery.effects.bounce.js @@ -14,7 +14,7 @@ var rshowhide = /show|hide/; -$.effects.bounce = function(o) { +$.effects.effect.bounce = function(o) { return this.queue(function() { diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js index 8cf91da57..14b358dfa 100644 --- a/ui/jquery.effects.clip.js +++ b/ui/jquery.effects.clip.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.clip = function( o ) { +$.effects.effect.clip = function( o ) { return this.queue( function() { diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 0d326954a..573cb2554 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -9,7 +9,11 @@ */ ;jQuery.effects || (function($, undefined) { -$.effects = {}; +var backCompat = $.uiBackCompat !== false; + +$.effects = { + effect: {} +}; /******************************************************************************/ /****************************** COLOR ANIMATIONS ******************************/ @@ -493,7 +497,11 @@ function standardSpeed( speed ) { } // invalid strings - treat as "normal" speed - if ( typeof speed === "string" && !$.effects[ speed ] ) { + if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { + // TODO: remove in 2.0 (#7115) + if ( backCompat && $.effects[ speed ] ) { + return false; + } return true; } @@ -504,9 +512,12 @@ $.fn.extend({ effect: function( effect, options, speed, callback ) { var args = _normalizeArguments.apply( this, arguments ), mode = args.mode, - effectMethod = $.effects[ args.effect ]; - - if ( $.fx.off || !effectMethod ) { + effectMethod = $.effects.effect[ args.effect ], + + // DEPRECATED: remove in 2.0 (#7115) + oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ]; + + if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { // delegate to the original method (e.g., .show()) if possible if ( mode ) { return this[ mode ]( args.duration, args.complete ); @@ -518,7 +529,19 @@ $.fn.extend({ }); } } - return effectMethod.call( this, args ); + + // TODO: remove this check in 2.0, effectMethod will always be true + if ( effectMethod ) { + return effectMethod.call( this, args ); + } else { + // DEPRECATED: remove in 2.0 (#7115) + return oldEffectMethod.call(this, { + options: args, + duration: args.duration, + callback: args.complete, + mode: args.mode + }); + } }, _show: $.fn.show, diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js index b88a8c428..24fb89db0 100644 --- a/ui/jquery.effects.drop.js +++ b/ui/jquery.effects.drop.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.drop = function( o ) { +$.effects.effect.drop = function( o ) { return this.queue( function() { diff --git a/ui/jquery.effects.explode.js b/ui/jquery.effects.explode.js index 79cf1a9fb..f5217ecb5 100644 --- a/ui/jquery.effects.explode.js +++ b/ui/jquery.effects.explode.js @@ -12,66 +12,83 @@ */ (function( $, undefined ) { -$.effects.explode = function( o ) { +$.effects.effect.explode = function( o ) { return this.queue( function( next ) { var rows = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3, cells = rows, - el = $( this ).show().css( 'visibility', 'hidden' ), + el = $( this ), mode = $.effects.setMode( el, o.mode || 'hide' ), - offset = el.offset(), - width = el.outerWidth( true ), - height = el.outerHeight( true ), - peices = []; + show = ( mode == 'show' ), - //Substract the margins - not fixing the problem yet. - offset.top -= parseInt( el.css( "marginTop" ), 10 ) || 0; - offset.left -= parseInt( el.css( "marginLeft" ), 10 ) || 0; + // show and then visibility:hidden the element before calculating offset + offset = el.show().css( 'visibility', 'hidden' ).offset(), + + // width and height of a piece + width = Math.ceil( el.outerWidth() / cells ), + height = Math.ceil( el.outerHeight() / rows ), + pieces = [], + + // loop + i, j, left, top, mx, my; // clone the element for each row and cell. - for( var i = 0; i < rows ; i++ ) { // = - for( var j = 0; j < cells ; j++ ) { // || + for( i = 0; i < rows ; i++ ) { // ===> + top = offset.top + i * height; + my = i - ( rows - 1 ) / 2 ; + + for( j = 0; j < cells ; j++ ) { // ||| + left = offset.left + j * width; + mx = j - ( cells - 1 ) / 2 ; + + // Create a clone of the now hidden main element that will be absolute positioned + // within a wrapper div off the -left and -top equal to size of our pieces el .clone() - .appendTo('body') - .wrap('<div></div>') + .appendTo( 'body' ) + .wrap( '<div></div>' ) .css({ position: 'absolute', visibility: 'visible', - left: -j*(width/cells), - top: -i*(height/rows) + left: -j * width, + top: -i * height }) + + // select the wrapper - make it overflow: hidden and absolute positioned based on + // where the original was located +left and +top equal to the size of pieces .parent() - .addClass('ui-effects-explode') + .addClass( 'ui-effects-explode' ) .css({ position: 'absolute', overflow: 'hidden', - width: width/cells, - height: height/rows, - left: offset.left + j*(width/cells) + (o.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0), - top: offset.top + i*(height/rows) + (o.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0), - opacity: mode == 'show' ? 0 : 1 + width: width, + height: height, + left: left + ( show ? mx * width : 0 ), + top: top + ( show ? my * height : 0 ), + opacity: show ? 0 : 1 }).animate({ - left: offset.left + j*(width/cells) + (o.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)), - top: offset.top + i*(height/rows) + (o.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)), - opacity: mode == 'show' ? 1 : 0 - }, o.duration || 500, childComplete ); + left: left + ( show ? 0 : mx * width ), + top: top + ( show ? 0 : my * height ), + opacity: show ? 1 : 0 + }, o.duration || 500, o.easing, childComplete ); } } // children animate complete: function childComplete() { - peices.push( this ); - if ( peices.length == rows * cells ) { + pieces.push( this ); + if ( pieces.length == rows * cells ) { animComplete(); } } function animComplete() { - el.css({ visibility: 'visible' }); - $( peices ).remove(); - if ( mode != 'show' ) { + el.css({ + visibility: 'visible' + }); + $( pieces ).remove(); + if ( !show ) { el.hide(); } if ( $.isFunction( o.complete ) ) { diff --git a/ui/jquery.effects.fade.js b/ui/jquery.effects.fade.js index 825c84e78..5fa0319c0 100644 --- a/ui/jquery.effects.fade.js +++ b/ui/jquery.effects.fade.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.fade = function( o ) { +$.effects.effect.fade = function( o ) { return this.queue( function() { var el = $( this ), mode = $.effects.setMode( el, o.mode || 'hide' ); diff --git a/ui/jquery.effects.fold.js b/ui/jquery.effects.fold.js index 19e97c40f..29da090cb 100644 --- a/ui/jquery.effects.fold.js +++ b/ui/jquery.effects.fold.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.fold = function( o ) { +$.effects.effect.fold = function( o ) { return this.queue( function() { diff --git a/ui/jquery.effects.highlight.js b/ui/jquery.effects.highlight.js index b2ffb15e8..cd4f0705a 100644 --- a/ui/jquery.effects.highlight.js +++ b/ui/jquery.effects.highlight.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.highlight = function( o ) { +$.effects.effect.highlight = function( o ) { return this.queue( function() { var elem = $( this ), props = [ 'backgroundImage', 'backgroundColor', 'opacity' ], diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js index c5f67b12b..b168b6ef5 100644 --- a/ui/jquery.effects.pulsate.js +++ b/ui/jquery.effects.pulsate.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.pulsate = function( o ) { +$.effects.effect.pulsate = function( o ) { return this.queue( function() { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || 'show' ), diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index fcc0708b9..8f25ca9a8 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.puff = function( o ) { +$.effects.effect.puff = function( o ) { return this.queue( function() { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || 'hide' ), @@ -40,7 +40,7 @@ $.effects.puff = function( o ) { }); }; -$.effects.scale = function( o ) { +$.effects.effect.scale = function( o ) { return this.queue( function() { @@ -92,7 +92,7 @@ $.effects.scale = function( o ) { }; -$.effects.size = function( o ) { +$.effects.effect.size = function( o ) { return this.queue( function() { // Create element diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js index 5e8875abe..a1ba1577c 100644 --- a/ui/jquery.effects.shake.js +++ b/ui/jquery.effects.shake.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.shake = function( o ) { +$.effects.effect.shake = function( o ) { return this.queue( function() { diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index eeba117cf..6b0296754 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.slide = function( o ) { +$.effects.effect.slide = function( o ) { return this.queue( function() { diff --git a/ui/jquery.effects.transfer.js b/ui/jquery.effects.transfer.js index 79b1577d9..17d23c5fa 100644 --- a/ui/jquery.effects.transfer.js +++ b/ui/jquery.effects.transfer.js @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.effects.transfer = function( o ) { +$.effects.effect.transfer = function( o ) { return this.queue( function() { var elem = $( this ), diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 34327be27..7f67814b4 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -75,6 +75,7 @@ $.widget( "ui.accordion", { .not( self.active ) .attr({ "aria-expanded": "false", + "aria-selected": "false", tabIndex: -1 }) .next() @@ -87,6 +88,7 @@ $.widget( "ui.accordion", { self.active .attr({ "aria-expanded": "true", + "aria-selected": "true", tabIndex: 0 }); } @@ -129,6 +131,7 @@ $.widget( "ui.accordion", { .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) .removeAttr( "role" ) .removeAttr( "aria-expanded" ) + .removeAttr( "aria-selected" ) .removeAttr( "tabIndex" ) .find( "a" ) .removeAttr( "tabIndex" ) @@ -387,12 +390,14 @@ $.widget( "ui.accordion", { toHide.prev() .attr({ "aria-expanded": "false", + "aria-selected": "false", tabIndex: -1 }) .blur(); toShow.prev() .attr({ "aria-expanded": "true", + "aria-selected": "true", tabIndex: 0 }) .focus(); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index c83f042c0..ee6eb659f 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -22,6 +22,7 @@ $.widget( "ui.autocomplete", { defaultElement: "<input>", options: { appendTo: "body", + autoFocus: true, delay: 300, minLength: 1, position: { @@ -368,6 +369,10 @@ $.widget( "ui.autocomplete", { ul.position( $.extend({ of: this.element }, this.options.position )); + + if ( this.options.autoFocus ) { + this.menu.next( new $.Event("mouseover") ); + } }, _resizeMenu: function() { diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 9cf8974b2..5777d4753 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -183,21 +183,17 @@ $.widget( "ui.button", { }, _determineButtonType: function() { - + if ( this.element.is(":checkbox") ) { this.type = "checkbox"; + } else if ( this.element.is(":radio") ) { + this.type = "radio"; + } else if ( this.element.is("input") ) { + this.type = "input"; } else { - if ( this.element.is(":radio") ) { - this.type = "radio"; - } else { - if ( this.element.is("input") ) { - this.type = "input"; - } else { - this.type = "button"; - } - } + this.type = "button"; } - + if ( this.type === "checkbox" || this.type === "radio" ) { // we don't search against the document in case the element // is disconnected from the DOM diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 8dd9bf3dc..ed02335e5 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -656,7 +656,9 @@ $.extend(Datepicker.prototype, { } }; inst.dpDiv.zIndex($(input).zIndex()+1); - if ($.effects && $.effects[showAnim]) + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); @@ -781,7 +783,9 @@ $.extend(Datepicker.prototype, { $.datepicker._tidyDialog(inst); this._curInst = null; }; - if ($.effects && $.effects[showAnim]) + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : @@ -1089,7 +1093,7 @@ $.extend(Datepicker.prototype, { } var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) - throw 'Invalid date'; // E.g. 31/02/* + throw 'Invalid date'; // E.g. 31/02/00 return date; }, diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 304240130..ff1ad1363 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -477,7 +477,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { instance: sortable, shouldRevert: sortable.options.revert }); - sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache + sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). sortable._trigger("activate", event, uiSortable); } }); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index cd07b6418..af1101f73 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -17,6 +17,7 @@ var idIncrement = 0; $.widget("ui.menu", { defaultElement: "<ul>", + delay: 150, options: { position: { my: "left top", @@ -34,14 +35,19 @@ $.widget("ui.menu", { role: "listbox" }) .bind( "click.menu", function( event ) { + var item = $( event.target ).closest( ".ui-menu-item:has(a)" ); if ( self.options.disabled ) { return false; } - if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) { + if ( !item.length ) { return; } // temporary event.preventDefault(); + // it's possible to click an item without hovering it (#7085) + if ( !self.active || ( self.active[ 0 ] !== item[ 0 ] ) ) { + self.focus( event, item ); + } self.select( event ); }) .bind( "mouseover.menu", function( event ) { @@ -102,10 +108,16 @@ $.widget("ui.menu", { event.preventDefault(); break; case $.ui.keyCode.ENTER: - self.select(); + self.select( event ); event.preventDefault(); event.stopImmediatePropagation(); break; + case $.ui.keyCode.ESCAPE: + if ( self.left( event ) ) { + event.stopImmediatePropagation(); + } + event.preventDefault(); + break; default: event.stopPropagation(); clearTimeout(self.filterTimer); @@ -214,11 +226,13 @@ $.widget("ui.menu", { // need to remove the attribute before adding it for the screenreader to pick up the change // see http://groups.google.com/group/jquery-a11y/msg/929e0c1e8c5efc8f this.element.removeAttr("aria-activedescendant").attr("aria-activedescendant", self.itemId) - - self._close(); + + self.timer = setTimeout(function() { + self._close(); + }, self.delay) var nested = $(">ul", item); if (nested.length && /^mouse/.test(event.type)) { - self._open(nested); + self._startOpening(nested); } this.activeMenu = item.parent(); @@ -230,6 +244,8 @@ $.widget("ui.menu", { return; } + clearTimeout(this.timer); + this.active.children( "a" ).removeClass( "ui-state-focus" ); // remove only generated id $( "#" + this.menuId + "-activedescendant" ).removeAttr( "id" ); @@ -238,9 +254,18 @@ $.widget("ui.menu", { this.active = null; }, + _startOpening: function(submenu) { + clearTimeout(this.timer); + var self = this; + self.timer = setTimeout(function() { + self._close(); + self._open(submenu); + }, self.delay); + }, + _open: function(submenu) { this.element.find(".ui-menu").not(submenu.parents()).hide(); - + var position = $.extend({}, { of: this.active }, $.type(this.options.position) == "function" diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 10a25b611..6c6ba3864 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -262,6 +262,8 @@ $.Widget.prototype = { handlers = element; element = this.element; } else { + // accept selectors, DOM elements + element = $( element ); this.bindings = this.bindings.add( element ); } var instance = this; |