From cd364fba4c45f80cfd326f786c3d4901b2d464c2 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Tue, 20 Sep 2011 10:58:52 +0200 Subject: updated jquery-ui --- site-media/js/jquery-ui.js | 1550 +++++++++++++++++++++++++------------------- 1 file changed, 881 insertions(+), 669 deletions(-) (limited to 'site-media/js/jquery-ui.js') diff --git a/site-media/js/jquery-ui.js b/site-media/js/jquery-ui.js index cb5b331..a752a03 100644 --- a/site-media/js/jquery-ui.js +++ b/site-media/js/jquery-ui.js @@ -1,5 +1,5 @@ /*! - * jQuery UI @VERSION + * jQuery UI 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -18,7 +18,7 @@ if ( $.ui.version ) { } $.extend( $.ui, { - version: "@VERSION", + version: "1.9pre", keyCode: { ALT: 18, @@ -306,7 +306,7 @@ $.extend( $.ui, { })( jQuery ); /*! - * jQuery UI Widget @VERSION + * jQuery UI Widget 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -321,7 +321,10 @@ var slice = Array.prototype.slice; var _cleanData = $.cleanData; $.cleanData = function( elems ) { for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - $( elem ).triggerHandler( "remove" ); + try { + $( elem ).triggerHandler( "remove" ); + // http://bugs.jquery.com/ticket/8235 + } catch( e ) {} } _cleanData( elems ); }; @@ -574,9 +577,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; @@ -612,9 +615,10 @@ $.Widget.prototype = { element = $( element ); this.bindings = this.bindings.add( element ); } + var instance = this; $.each( handlers, function( event, handler ) { - element.bind( event + "." + instance.widgetName, function() { + function handlerProxy() { // allow widgets to customize the disabled handling // - disabled as an array instead of boolean // - disabled class as method for disabling individual parts @@ -624,10 +628,27 @@ $.Widget.prototype = { } return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); - }); + } + var match = event.match( /^(\w+)\s*(.*)$/ ), + eventName = match[1] + "." + instance.widgetName, + selector = match[2]; + if ( selector ) { + instance.widget().delegate( selector, eventName, handlerProxy ); + } else { + element.bind( eventName, handlerProxy ); + } }); }, + _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, { @@ -729,7 +750,7 @@ if ( $.uiBackCompat !== false ) { })( jQuery ); /*! - * jQuery UI Mouse @VERSION + * jQuery UI Mouse 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -743,12 +764,12 @@ if ( $.uiBackCompat !== false ) { (function( $, undefined ) { var mouseHandled = false; -$(document).mousedown(function(e) { +$( document ).mouseup( function( e ) { mouseHandled = false; }); $.widget("ui.mouse", { - version: "@VERSION", + version: "1.9pre", options: { cancel: ':input,option', distance: 1, @@ -780,7 +801,7 @@ $.widget("ui.mouse", { _mouseDown: function(event) { // don't let more than one widget handle mouseStart - if(mouseHandled) {return}; + if( mouseHandled ) { return }; // we may have missed mouseup (out of window) (this._mouseStarted && this._mouseUp(event)); @@ -789,7 +810,9 @@ $.widget("ui.mouse", { var self = this, btnIsLeft = (event.which == 1), - elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).closest(this.options.cancel).length : false); + // event.target.nodeName works around a bug in IE 8 with + // disabled inputs (#7620) + elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true; } @@ -890,7 +913,7 @@ $.widget("ui.mouse", { })(jQuery); /* - * jQuery UI Draggable @VERSION + * jQuery UI Draggable 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -906,7 +929,7 @@ $.widget("ui.mouse", { (function( $, undefined ) { $.widget("ui.draggable", $.ui.mouse, { - version: "@VERSION", + version: "1.9pre", widgetEventPrefix: "drag", options: { addClasses: true, @@ -1710,7 +1733,7 @@ $.ui.plugin.add("draggable", "zIndex", { })(jQuery); /* - * jQuery UI Droppable @VERSION + * jQuery UI Droppable 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -1727,7 +1750,7 @@ $.ui.plugin.add("draggable", "zIndex", { (function( $, undefined ) { $.widget("ui.droppable", { - version: "@VERSION", + version: "1.9pre", widgetEventPrefix: "drop", options: { accept: '*', @@ -2003,7 +2026,7 @@ $.ui.ddmanager = { })(jQuery); /* - * jQuery UI Resizable @VERSION + * jQuery UI Resizable 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -2019,7 +2042,7 @@ $.ui.ddmanager = { (function( $, undefined ) { $.widget("ui.resizable", $.ui.mouse, { - version: "@VERSION", + version: "1.9pre", widgetEventPrefix: "resize", options: { alsoResize: false, @@ -2842,7 +2865,7 @@ var isNumber = function(value) { })(jQuery); /* - * jQuery UI Selectable @VERSION + * jQuery UI Selectable 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -2858,7 +2881,7 @@ var isNumber = function(value) { (function( $, undefined ) { $.widget("ui.selectable", $.ui.mouse, { - version: "@VERSION", + version: "1.9pre", options: { appendTo: 'body', autoRefresh: true, @@ -3105,7 +3128,7 @@ $.widget("ui.selectable", $.ui.mouse, { })(jQuery); /* - * jQuery UI Sortable @VERSION + * jQuery UI Sortable 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -3121,7 +3144,7 @@ $.widget("ui.selectable", $.ui.mouse, { (function( $, undefined ) { $.widget("ui.sortable", $.ui.mouse, { - version: "@VERSION", + version: "1.9pre", widgetEventPrefix: "sort", options: { appendTo: "parent", @@ -4178,7 +4201,7 @@ $.widget("ui.sortable", $.ui.mouse, { })(jQuery); /* - * jQuery UI Effects @VERSION + * jQuery UI Effects 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -4518,7 +4541,7 @@ $.fn.extend({ /******************************************************************************/ $.extend( $.effects, { - version: "@VERSION", + version: "1.9pre", // Saves a set of properties in a data storage save: function( element, set ) { @@ -4594,9 +4617,16 @@ $.extend( $.effects, { size = { width: element.width(), height: element.height() - }; + }, + active = document.activeElement; element.wrap( wrapper ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element // transfer positioning properties to the wrapper @@ -4628,8 +4658,18 @@ $.extend( $.effects, { }, removeWrapper: function( element ) { - if ( element.parent().is( ".ui-effects-wrapper" ) ) - return element.parent().replaceWith( element ); + var active = document.activeElement; + + if ( element.parent().is( ".ui-effects-wrapper" ) ) { + element.parent().replaceWith( element ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + } + + return element; }, @@ -5051,7 +5091,7 @@ $.extend( $.easing, { })(jQuery); /* - * jQuery UI Effects Blind @VERSION + * jQuery UI Effects Blind 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5130,7 +5170,7 @@ $.effects.effect.blind = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Bounce @VERSION + * jQuery UI Effects Bounce 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5242,7 +5282,7 @@ $.effects.effect.bounce = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Clip @VERSION + * jQuery UI Effects Clip 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5308,7 +5348,7 @@ $.effects.effect.clip = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Drop @VERSION + * jQuery UI Effects Drop 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5371,7 +5411,7 @@ $.effects.effect.drop = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Explode @VERSION + * jQuery UI Effects Explode 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5467,7 +5507,7 @@ $.effects.effect.explode = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Fade @VERSION + * jQuery UI Effects Fade 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5503,7 +5543,7 @@ $.effects.effect.fade = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Fold @VERSION + * jQuery UI Effects Fold 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5577,7 +5617,7 @@ $.effects.effect.fold = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Highlight @VERSION + * jQuery UI Effects Highlight 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5626,7 +5666,7 @@ $.effects.effect.highlight = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Pulsate @VERSION + * jQuery UI Effects Pulsate 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5688,7 +5728,7 @@ $.effects.effect.pulsate = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Scale @VERSION + * jQuery UI Effects Scale 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -5990,7 +6030,7 @@ $.effects.effect.size = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Shake @VERSION + * jQuery UI Effects Shake 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -6064,7 +6104,7 @@ $.effects.effect.shake = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Slide @VERSION + * jQuery UI Effects Slide 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -6131,7 +6171,7 @@ $.effects.effect.slide = function( o, done ) { })(jQuery); /* - * jQuery UI Effects Transfer @VERSION + * jQuery UI Effects Transfer 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -6177,7 +6217,7 @@ $.effects.effect.transfer = function( o, done ) { })(jQuery); /* - * jQuery UI Accordion @VERSION + * jQuery UI Accordion 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -6190,10 +6230,12 @@ $.effects.effect.transfer = function( o, done ) { * jquery.ui.widget.js */ (function( $, undefined ) { + +var lastToggle = {}; // TODO: use ui-accordion-header-active class and fix styling $.widget( "ui.accordion", { - version: "@VERSION", + version: "1.9pre", options: { active: 0, animated: "slide", @@ -6215,8 +6257,6 @@ $.widget( "ui.accordion", { var self = this, options = self.options; - self.running = false; - self.element.addClass( "ui-accordion ui-widget ui-helper-reset" ); self.headers = self.element.find( options.header ) @@ -6268,12 +6308,11 @@ $.widget( "ui.accordion", { if ( !self.active.length ) { self.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { - self.active - .attr({ - "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 - }); + self.active.attr({ + "aria-expanded": "true", + "aria-selected": "true", + tabIndex: 0 + }); } // only need links in tab order for Safari @@ -6340,6 +6379,13 @@ $.widget( "ui.accordion", { return; } + if ( key === "event" ) { + if ( this.options.event ) { + this.headers.unbind( this.options.event + ".accordion", this._eventHandler ); + } + this._setupEvents( value ); + } + this._super( "_setOption", key, value ); // setting collapsible: false while collapsed; open first panel @@ -6347,10 +6393,6 @@ $.widget( "ui.accordion", { this._activate( 0 ); } - if ( key === "event" ) { - this._setupEvents( value ); - } - if ( key === "icons" ) { this._destroyIcons(); if ( value ) { @@ -6472,7 +6514,6 @@ $.widget( "ui.accordion", { }, _setupEvents: function( event ) { - this.headers.unbind( ".accordion" ); if ( event ) { this.headers.bind( event.split( " " ).join( ".accordion " ) + ".accordion", $.proxy( this, "_eventHandler" ) ); @@ -6497,8 +6538,6 @@ $.widget( "ui.accordion", { event.preventDefault(); if ( options.disabled || - // can't switch during an animation - this.running || // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || // allow canceling activation @@ -6539,7 +6578,6 @@ $.widget( "ui.accordion", { toShow = data.newContent, toHide = data.oldContent; - self.running = true; function complete() { self._completed( data ); } @@ -6560,6 +6598,8 @@ $.widget( "ui.accordion", { animations[ animation ]({ toShow: toShow, toHide: toHide, + prevShow: lastToggle.toShow, + prevHide: lastToggle.toHide, complete: complete, down: toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) ) }, additional ); @@ -6590,8 +6630,6 @@ $.widget( "ui.accordion", { var toShow = data.newContent, toHide = data.oldContent; - this.running = false; - if ( this.options.heightStyle === "content" ) { toShow.add( toHide ).css({ height: "", @@ -6613,6 +6651,11 @@ $.widget( "ui.accordion", { $.extend( $.ui.accordion, { animations: { slide: function( options, additions ) { + if ( options.prevShow || options.prevHide ) { + options.prevHide.stop( true, true ); + options.toHide = options.prevShow; + } + var showOverflow = options.toShow.css( "overflow" ), hideOverflow = options.toHide.css( "overflow" ), percentDone = 0, @@ -6624,6 +6667,9 @@ $.extend( $.ui.accordion, { easing: "swing", duration: 300 }, options, additions ); + + lastToggle = options; + if ( !options.toHide.size() ) { originalWidth = options.toShow[0].style.width; options.toShow @@ -6680,10 +6726,7 @@ $.extend( $.ui.accordion, { .filter( ":visible" ) .animate( hideProps, { step: function( now, settings ) { - // only calculate the percent when animating height - // IE gets very inconsistent results when animating elements - // with small values, which is common for padding - if ( settings.prop == "height" ) { + if ( settings.prop == "height" || settings.prop == "paddingTop" || settings.prop == "paddingBottom" ) { percentDone = ( settings.end - settings.start === 0 ) ? 0 : ( settings.now - settings.start ) / ( settings.end - settings.start ); } @@ -6857,7 +6900,7 @@ if ( $.uiBackCompat !== false ) { })( jQuery ); /* - * jQuery UI Autocomplete @VERSION + * jQuery UI Autocomplete 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -6877,7 +6920,7 @@ if ( $.uiBackCompat !== false ) { var requestIndex = 0; $.widget( "ui.autocomplete", { - version: "@VERSION", + version: "1.9pre", defaultElement: "", options: { appendTo: "body", @@ -6909,7 +6952,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" ) @@ -6921,7 +6964,7 @@ $.widget( "ui.autocomplete", { "aria-haspopup": "true" }) .bind( "keydown.autocomplete", function( event ) { - if ( self.options.disabled || self.element.attr( "readonly" ) ) { + if ( self.options.disabled || self.element.prop( "readOnly" ) ) { suppressKeyPress = true; suppressInput = true; return; @@ -7121,6 +7164,7 @@ $.widget( "ui.autocomplete", { }, _destroy: function() { + clearTimeout( this.searching ); this.element .removeClass( "ui-autocomplete-input" ) .removeAttr( "autocomplete" ) @@ -7347,7 +7391,7 @@ $.extend( $.ui.autocomplete, { }( jQuery )); /* - * jQuery UI Button @VERSION + * jQuery UI Button 1.9pre * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -7389,7 +7433,7 @@ var lastActive, startXPos, startYPos, clickDragged, }; $.widget( "ui.button", { - version: "@VERSION", + version: "1.9pre", defaultElement: "