Updating jQuery UI to 1.8.11 (was 1.8.2). Also loosening button css, since j.ui.butto...
authorLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 14 Apr 2011 13:09:02 +0000 (13:09 +0000)
committerLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 14 Apr 2011 13:09:02 +0000 (13:09 +0000)
18 files changed:
resources/jquery.ui/jquery.ui.accordion.js
resources/jquery.ui/jquery.ui.autocomplete.js
resources/jquery.ui/jquery.ui.button.js
resources/jquery.ui/jquery.ui.core.js
resources/jquery.ui/jquery.ui.datepicker.js
resources/jquery.ui/jquery.ui.dialog.js
resources/jquery.ui/jquery.ui.draggable.js
resources/jquery.ui/jquery.ui.droppable.js
resources/jquery.ui/jquery.ui.mouse.js
resources/jquery.ui/jquery.ui.position.js
resources/jquery.ui/jquery.ui.progressbar.js
resources/jquery.ui/jquery.ui.resizable.js
resources/jquery.ui/jquery.ui.selectable.js
resources/jquery.ui/jquery.ui.slider.js
resources/jquery.ui/jquery.ui.sortable.js
resources/jquery.ui/jquery.ui.tabs.js
resources/jquery.ui/jquery.ui.widget.js
resources/jquery.ui/themes/vector/jquery.ui.button.css

index 7d926e0..898160a 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Accordion 1.8.2
+ * jQuery UI Accordion 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Accordion
  *
  *     jquery.ui.core.js
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
-$.widget("ui.accordion", {
+$.widget( "ui.accordion", {
        options: {
                active: 0,
-               animated: 'slide',
+               animated: "slide",
                autoHeight: true,
                clearStyle: false,
                collapsible: false,
@@ -29,322 +29,398 @@ $.widget("ui.accordion", {
                },
                navigation: false,
                navigationFilter: function() {
-                       return this.href.toLowerCase() == location.href.toLowerCase();
+                       return this.href.toLowerCase() === location.href.toLowerCase();
                }
        },
-       _create: function() {
-
-               var o = this.options, self = this;
-               this.running = 0;
 
-               this.element.addClass("ui-accordion ui-widget ui-helper-reset");
-               
-               // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
-               this.element.children("li").addClass("ui-accordion-li-fix");
-
-               this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
-                       .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); })
-                       .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); })
-                       .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); })
-                       .bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); });
+       _create: function() {
+               var self = this,
+                       options = self.options;
+
+               self.running = 0;
+
+               self.element
+                       .addClass( "ui-accordion ui-widget ui-helper-reset" )
+                       // in lack of child-selectors in CSS
+                       // we need to mark top-LIs in a UL-accordion for some IE-fix
+                       .children( "li" )
+                               .addClass( "ui-accordion-li-fix" );
+
+               self.headers = self.element.find( options.header )
+                       .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
+                       .bind( "mouseenter.accordion", function() {
+                               if ( options.disabled ) {
+                                       return;
+                               }
+                               $( this ).addClass( "ui-state-hover" );
+                       })
+                       .bind( "mouseleave.accordion", function() {
+                               if ( options.disabled ) {
+                                       return;
+                               }
+                               $( this ).removeClass( "ui-state-hover" );
+                       })
+                       .bind( "focus.accordion", function() {
+                               if ( options.disabled ) {
+                                       return;
+                               }
+                               $( this ).addClass( "ui-state-focus" );
+                       })
+                       .bind( "blur.accordion", function() {
+                               if ( options.disabled ) {
+                                       return;
+                               }
+                               $( this ).removeClass( "ui-state-focus" );
+                       });
 
-               this.headers
-                       .next()
-                               .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
+               self.headers.next()
+                       .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
 
-               if ( o.navigation ) {
-                       var current = this.element.find("a").filter(o.navigationFilter);
+               if ( options.navigation ) {
+                       var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
                        if ( current.length ) {
-                               var header = current.closest(".ui-accordion-header");
+                               var header = current.closest( ".ui-accordion-header" );
                                if ( header.length ) {
                                        // anchor within header
-                                       this.active = header;
+                                       self.active = header;
                                } else {
                                        // anchor within content
-                                       this.active = current.closest(".ui-accordion-content").prev();
+                                       self.active = current.closest( ".ui-accordion-content" ).prev();
                                }
                        }
                }
 
-               this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
-               this.active.next().addClass('ui-accordion-content-active');
-
-               //Append icon elements
-               this._createIcons();
-
-               this.resize();
+               self.active = self._findActive( self.active || options.active )
+                       .addClass( "ui-state-default ui-state-active" )
+                       .toggleClass( "ui-corner-all" )
+                       .toggleClass( "ui-corner-top" );
+               self.active.next().addClass( "ui-accordion-content-active" );
 
-               //ARIA
-               this.element.attr('role','tablist');
-
-               this.headers
-                       .attr('role','tab')
-                       .bind('keydown', function(event) { return self._keydown(event); })
+               self._createIcons();
+               self.resize();
+               
+               // ARIA
+               self.element.attr( "role", "tablist" );
+
+               self.headers
+                       .attr( "role", "tab" )
+                       .bind( "keydown.accordion", function( event ) {
+                               return self._keydown( event );
+                       })
                        .next()
-                       .attr('role','tabpanel');
-
-               this.headers
-                       .not(this.active || "")
-                       .attr('aria-expanded','false')
-                       .attr("tabIndex", "-1")
+                               .attr( "role", "tabpanel" );
+
+               self.headers
+                       .not( self.active || "" )
+                       .attr({
+                               "aria-expanded": "false",
+                               "aria-selected": "false",
+                               tabIndex: -1
+                       })
                        .next()
-                       .hide();
+                               .hide();
 
                // make sure at least one header is in the tab order
-               if (!this.active.length) {
-                       this.headers.eq(0).attr('tabIndex','0');
+               if ( !self.active.length ) {
+                       self.headers.eq( 0 ).attr( "tabIndex", 0 );
                } else {
-                       this.active
-                               .attr('aria-expanded','true')
-                               .attr('tabIndex', '0');
+                       self.active
+                               .attr({
+                                       "aria-expanded": "true",
+                                       "aria-selected": "true",
+                                       tabIndex: 0
+                               });
                }
 
-               // only need links in taborder for Safari
-               if (!$.browser.safari)
-                       this.headers.find('a').attr('tabIndex','-1');
+               // only need links in tab order for Safari
+               if ( !$.browser.safari ) {
+                       self.headers.find( "a" ).attr( "tabIndex", -1 );
+               }
 
-               if (o.event) {
-                       this.headers.bind((o.event) + ".accordion", function(event) {
-                               self._clickHandler.call(self, event, this);
+               if ( options.event ) {
+                       self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
+                               self._clickHandler.call( self, event, this );
                                event.preventDefault();
                        });
                }
-
        },
-       
+
        _createIcons: function() {
-               var o = this.options;
-               if (o.icons) {
-                       $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
-                       this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
-                       this.element.addClass("ui-accordion-icons");
+               var options = this.options;
+               if ( options.icons ) {
+                       $( "<span></span>" )
+                               .addClass( "ui-icon " + options.icons.header )
+                               .prependTo( this.headers );
+                       this.active.children( ".ui-icon" )
+                               .toggleClass(options.icons.header)
+                               .toggleClass(options.icons.headerSelected);
+                       this.element.addClass( "ui-accordion-icons" );
                }
        },
-       
+
        _destroyIcons: function() {
-               this.headers.children(".ui-icon").remove();
-               this.element.removeClass("ui-accordion-icons");
+               this.headers.children( ".ui-icon" ).remove();
+               this.element.removeClass( "ui-accordion-icons" );
        },
 
        destroy: function() {
-               var o = this.options;
+               var options = this.options;
 
                this.element
-                       .removeClass("ui-accordion ui-widget ui-helper-reset")
-                       .removeAttr("role")
-                       .unbind('.accordion')
-                       .removeData('accordion');
+                       .removeClass( "ui-accordion ui-widget ui-helper-reset" )
+                       .removeAttr( "role" );
 
                this.headers
-                       .unbind(".accordion")
-                       .removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
-                       .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");
-
-               this.headers.find("a").removeAttr("tabIndex");
+                       .unbind( ".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" );
+
+               this.headers.find( "a" ).removeAttr( "tabIndex" );
                this._destroyIcons();
-               var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
-               if (o.autoHeight || o.fillHeight) {
-                       contents.css("height", "");
+               var contents = this.headers.next()
+                       .css( "display", "" )
+                       .removeAttr( "role" )
+                       .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
+               if ( options.autoHeight || options.fillHeight ) {
+                       contents.css( "height", "" );
                }
 
-               return this;
+               return $.Widget.prototype.destroy.call( this );
        },
-       
-       _setOption: function(key, value) {
-               $.Widget.prototype._setOption.apply(this, arguments);
+
+       _setOption: function( key, value ) {
+               $.Widget.prototype._setOption.apply( this, arguments );
                        
-               if (key == "active") {
-                       this.activate(value);
+               if ( key == "active" ) {
+                       this.activate( value );
                }
-               if (key == "icons") {
+               if ( key == "icons" ) {
                        this._destroyIcons();
-                       if (value) {
+                       if ( value ) {
                                this._createIcons();
                        }
                }
-               
+               // #5332 - opacity doesn't cascade to positioned elements in IE
+               // so we need to add the disabled class to the headers and panels
+               if ( key == "disabled" ) {
+                       this.headers.add(this.headers.next())
+                               [ value ? "addClass" : "removeClass" ](
+                                       "ui-accordion-disabled ui-state-disabled" );
+               }
        },
 
-       _keydown: function(event) {
-
-               var o = this.options, keyCode = $.ui.keyCode;
-
-               if (o.disabled || event.altKey || event.ctrlKey)
+       _keydown: function( event ) {
+               if ( this.options.disabled || event.altKey || event.ctrlKey ) {
                        return;
+               }
 
-               var length = this.headers.length;
-               var currentIndex = this.headers.index(event.target);
-               var toFocus = false;
+               var keyCode = $.ui.keyCode,
+                       length = this.headers.length,
+                       currentIndex = this.headers.index( event.target ),
+                       toFocus = false;
 
-               switch(event.keyCode) {
+               switch ( event.keyCode ) {
                        case keyCode.RIGHT:
                        case keyCode.DOWN:
-                               toFocus = this.headers[(currentIndex + 1) % length];
+                               toFocus = this.headers[ ( currentIndex + 1 ) % length ];
                                break;
                        case keyCode.LEFT:
                        case keyCode.UP:
-                               toFocus = this.headers[(currentIndex - 1 + length) % length];
+                               toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
                                break;
                        case keyCode.SPACE:
                        case keyCode.ENTER:
-                               this._clickHandler({ target: event.target }, event.target);
+                               this._clickHandler( { target: event.target }, event.target );
                                event.preventDefault();
                }
 
-               if (toFocus) {
-                       $(event.target).attr('tabIndex','-1');
-                       $(toFocus).attr('tabIndex','0');
+               if ( toFocus ) {
+                       $( event.target ).attr( "tabIndex", -1 );
+                       $( toFocus ).attr( "tabIndex", 0 );
                        toFocus.focus();
                        return false;
                }
 
                return true;
-
        },
 
        resize: function() {
+               var options = this.options,
+                       maxHeight;
 
-               var o = this.options, maxHeight;
-
-               if (o.fillSpace) {
-                       
-                       if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
+               if ( options.fillSpace ) {
+                       if ( $.browser.msie ) {
+                               var defOverflow = this.element.parent().css( "overflow" );
+                               this.element.parent().css( "overflow", "hidden");
+                       }
                        maxHeight = this.element.parent().height();
-                       if($.browser.msie) { this.element.parent().css('overflow', defOverflow); }
-       
+                       if ($.browser.msie) {
+                               this.element.parent().css( "overflow", defOverflow );
+                       }
+
                        this.headers.each(function() {
-                               maxHeight -= $(this).outerHeight(true);
+                               maxHeight -= $( this ).outerHeight( true );
                        });
 
-                       this.headers.next().each(function() {
-                  $(this).height(Math.max(0, maxHeight - $(this).innerHeight() + $(this).height()));
-                       }).css('overflow', 'auto');
-
-               } else if ( o.autoHeight ) {
+                       this.headers.next()
+                               .each(function() {
+                                       $( this ).height( Math.max( 0, maxHeight -
+                                               $( this ).innerHeight() + $( this ).height() ) );
+                               })
+                               .css( "overflow", "auto" );
+               } else if ( options.autoHeight ) {
                        maxHeight = 0;
-                       this.headers.next().each(function() {
-                               maxHeight = Math.max(maxHeight, $(this).height());
-                       }).height(maxHeight);
+                       this.headers.next()
+                               .each(function() {
+                                       maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+                               })
+                               .height( maxHeight );
                }
 
                return this;
        },
 
-       activate: function(index) {
+       activate: function( index ) {
                // TODO this gets called on init, changing the option without an explicit call for that
                this.options.active = index;
                // call clickHandler with custom event
-               var active = this._findActive(index)[0];
-               this._clickHandler({ target: active }, active);
+               var active = this._findActive( index )[ 0 ];
+               this._clickHandler( { target: active }, active );
 
                return this;
        },
 
-       _findActive: function(selector) {
+       _findActive: function( selector ) {
                return selector
-                       ? typeof selector == "number"
-                               ? this.headers.filter(":eq(" + selector + ")")
-                               : this.headers.not(this.headers.not(selector))
+                       ? typeof selector === "number"
+                               ? this.headers.filter( ":eq(" + selector + ")" )
+                               : this.headers.not( this.headers.not( selector ) )
                        : selector === false
-                               ? $([])
-                               : this.headers.filter(":eq(0)");
+                               ? $( [] )
+                               : this.headers.filter( ":eq(0)" );
        },
 
-       // TODO isn't event.target enough? why the seperate target argument?
-       _clickHandler: function(event, target) {
-
-               var o = this.options;
-               if (o.disabled)
+       // TODO isn't event.target enough? why the separate target argument?
+       _clickHandler: function( event, target ) {
+               var options = this.options;
+               if ( options.disabled ) {
                        return;
+               }
 
                // called only when using activate(false) to close all parts programmatically
-               if (!event.target) {
-                       if (!o.collapsible)
+               if ( !event.target ) {
+                       if ( !options.collapsible ) {
                                return;
-                       this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
-                               .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
-                       this.active.next().addClass('ui-accordion-content-active');
+                       }
+                       this.active
+                               .removeClass( "ui-state-active ui-corner-top" )
+                               .addClass( "ui-state-default ui-corner-all" )
+                               .children( ".ui-icon" )
+                                       .removeClass( options.icons.headerSelected )
+                                       .addClass( options.icons.header );
+                       this.active.next().addClass( "ui-accordion-content-active" );
                        var toHide = this.active.next(),
                                data = {
-                                       options: o,
-                                       newHeader: $([]),
-                                       oldHeader: o.active,
-                                       newContent: $([]),
+                                       options: options,
+                                       newHeader: $( [] ),
+                                       oldHeader: options.active,
+                                       newContent: $( [] ),
                                        oldContent: toHide
                                },
-                               toShow = (this.active = $([]));
-                       this._toggle(toShow, toHide, data);
+                               toShow = ( this.active = $( [] ) );
+                       this._toggle( toShow, toHide, data );
                        return;
                }
 
                // get the click target
-               var clicked = $(event.currentTarget || target);
-               var clickedIsActive = clicked[0] == this.active[0];
-               
+               var clicked = $( event.currentTarget || target ),
+                       clickedIsActive = clicked[0] === this.active[0];
+
                // TODO the option is changed, is that correct?
                // TODO if it is correct, shouldn't that happen after determining that the click is valid?
-               o.active = o.collapsible && clickedIsActive ? false : $('.ui-accordion-header', this.element).index(clicked);
+               options.active = options.collapsible && clickedIsActive ?
+                       false :
+                       this.headers.index( clicked );
 
                // if animations are still active, or the active header is the target, ignore click
-               if (this.running || (!o.collapsible && clickedIsActive)) {
+               if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
                        return;
                }
 
-               // switch classes
-               this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
-                       .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
-               if (!clickedIsActive) {
-                       clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
-                               .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
-                       clicked.next().addClass('ui-accordion-content-active');
-               }
-
                // find elements to show and hide
-               var toShow = clicked.next(),
+               var active = this.active,
+                       toShow = clicked.next(),
                        toHide = this.active.next(),
                        data = {
-                               options: o,
-                               newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
+                               options: options,
+                               newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
                                oldHeader: this.active,
-                               newContent: clickedIsActive && o.collapsible ? $([]) : toShow,
+                               newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
                                oldContent: toHide
                        },
                        down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
 
+               // when the call to ._toggle() comes after the class changes
+               // it causes a very odd bug in IE 8 (see #6720)
                this.active = clickedIsActive ? $([]) : clicked;
-               this._toggle(toShow, toHide, data, clickedIsActive, down);
+               this._toggle( toShow, toHide, data, clickedIsActive, down );
 
-               return;
+               // switch classes
+               active
+                       .removeClass( "ui-state-active ui-corner-top" )
+                       .addClass( "ui-state-default ui-corner-all" )
+                       .children( ".ui-icon" )
+                               .removeClass( options.icons.headerSelected )
+                               .addClass( options.icons.header );
+               if ( !clickedIsActive ) {
+                       clicked
+                               .removeClass( "ui-state-default ui-corner-all" )
+                               .addClass( "ui-state-active ui-corner-top" )
+                               .children( ".ui-icon" )
+                                       .removeClass( options.icons.header )
+                                       .addClass( options.icons.headerSelected );
+                       clicked
+                               .next()
+                               .addClass( "ui-accordion-content-active" );
+               }
 
+               return;
        },
 
-       _toggle: function(toShow, toHide, data, clickedIsActive, down) {
+       _toggle: function( toShow, toHide, data, clickedIsActive, down ) {
+               var self = this,
+                       options = self.options;
 
-               var o = this.options, self = this;
+               self.toShow = toShow;
+               self.toHide = toHide;
+               self.data = data;
 
-               this.toShow = toShow;
-               this.toHide = toHide;
-               this.data = data;
-
-               var complete = function() { if(!self) return; return self._completed.apply(self, arguments); };
+               var complete = function() {
+                       if ( !self ) {
+                               return;
+                       }
+                       return self._completed.apply( self, arguments );
+               };
 
                // trigger changestart event
-               this._trigger("changestart", null, this.data);
+               self._trigger( "changestart", null, self.data );
 
                // count elements to animate
-               this.running = toHide.size() === 0 ? toShow.size() : toHide.size();
-
-               if (o.animated) {
+               self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
 
+               if ( options.animated ) {
                        var animOptions = {};
 
-                       if ( o.collapsible && clickedIsActive ) {
+                       if ( options.collapsible && clickedIsActive ) {
                                animOptions = {
-                                       toShow: $([]),
+                                       toShow: $( [] ),
                                        toHide: toHide,
                                        complete: complete,
                                        down: down,
-                                       autoHeight: o.autoHeight || o.fillSpace
+                                       autoHeight: options.autoHeight || options.fillSpace
                                };
                        } else {
                                animOptions = {
@@ -352,101 +428,120 @@ $.widget("ui.accordion", {
                                        toHide: toHide,
                                        complete: complete,
                                        down: down,
-                                       autoHeight: o.autoHeight || o.fillSpace
+                                       autoHeight: options.autoHeight || options.fillSpace
                                };
                        }
 
-                       if (!o.proxied) {
-                               o.proxied = o.animated;
+                       if ( !options.proxied ) {
+                               options.proxied = options.animated;
                        }
 
-                       if (!o.proxiedDuration) {
-                               o.proxiedDuration = o.duration;
+                       if ( !options.proxiedDuration ) {
+                               options.proxiedDuration = options.duration;
                        }
 
-                       o.animated = $.isFunction(o.proxied) ?
-                               o.proxied(animOptions) : o.proxied;
+                       options.animated = $.isFunction( options.proxied ) ?
+                               options.proxied( animOptions ) :
+                               options.proxied;
 
-                       o.duration = $.isFunction(o.proxiedDuration) ?
-                               o.proxiedDuration(animOptions) : o.proxiedDuration;
+                       options.duration = $.isFunction( options.proxiedDuration ) ?
+                               options.proxiedDuration( animOptions ) :
+                               options.proxiedDuration;
 
                        var animations = $.ui.accordion.animations,
-                               duration = o.duration,
-                               easing = o.animated;
+                               duration = options.duration,
+                               easing = options.animated;
 
-                       if (easing && !animations[easing] && !$.easing[easing]) {
-                               easing = 'slide';
+                       if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
+                               easing = "slide";
                        }
-                       if (!animations[easing]) {
-                               animations[easing] = function(options) {
-                                       this.slide(options, {
+                       if ( !animations[ easing ] ) {
+                               animations[ easing ] = function( options ) {
+                                       this.slide( options, {
                                                easing: easing,
                                                duration: duration || 700
                                        });
                                };
                        }
 
-                       animations[easing](animOptions);
-
+                       animations[ easing ]( animOptions );
                } else {
-
-                       if (o.collapsible && clickedIsActive) {
+                       if ( options.collapsible && clickedIsActive ) {
                                toShow.toggle();
                        } else {
                                toHide.hide();
                                toShow.show();
                        }
 
-                       complete(true);
-
+                       complete( true );
                }
 
                // TODO assert that the blur and focus triggers are really necessary, remove otherwise
-               toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur();
-               toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();
-
+               toHide.prev()
+                       .attr({
+                               "aria-expanded": "false",
+                               "aria-selected": "false",
+                               tabIndex: -1
+                       })
+                       .blur();
+               toShow.prev()
+                       .attr({
+                               "aria-expanded": "true",
+                               "aria-selected": "true",
+                               tabIndex: 0
+                       })
+                       .focus();
        },
 
-       _completed: function(cancel) {
-
-               var o = this.options;
-
+       _completed: function( cancel ) {
                this.running = cancel ? 0 : --this.running;
-               if (this.running) return;
+               if ( this.running ) {
+                       return;
+               }
 
-               if (o.clearStyle) {
-                       this.toShow.add(this.toHide).css({
+               if ( this.options.clearStyle ) {
+                       this.toShow.add( this.toHide ).css({
                                height: "",
                                overflow: ""
                        });
                }
-               
+
                // other classes are removed before the animation; this one needs to stay until completed
-               this.toHide.removeClass("ui-accordion-content-active");
+               this.toHide.removeClass( "ui-accordion-content-active" );
+               // Work around for rendering bug in IE (#5421)
+               if ( this.toHide.length ) {
+                       this.toHide.parent()[0].className = this.toHide.parent()[0].className;
+               }
 
-               this._trigger('change', null, this.data);
+               this._trigger( "change", null, this.data );
        }
-
 });
 
-
-$.extend($.ui.accordion, {
-       version: "1.8.2",
+$.extend( $.ui.accordion, {
+       version: "1.8.11",
        animations: {
-               slide: function(options, additions) {
+               slide: function( options, additions ) {
                        options = $.extend({
                                easing: "swing",
                                duration: 300
-                       }, options, additions);
+                       }, options, additions );
                        if ( !options.toHide.size() ) {
-                               options.toShow.animate({height: "show"}, options);
+                               options.toShow.animate({
+                                       height: "show",
+                                       paddingTop: "show",
+                                       paddingBottom: "show"
+                               }, options );
                                return;
                        }
                        if ( !options.toShow.size() ) {
-                               options.toHide.animate({height: "hide"}, options);
+                               options.toHide.animate({
+                                       height: "hide",
+                                       paddingTop: "hide",
+                                       paddingBottom: "hide"
+                               }, options );
                                return;
                        }
-                       var overflow = options.toShow.css('overflow'),
+                       var overflow = options.toShow.css( "overflow" ),
                                percentDone = 0,
                                showProps = {},
                                hideProps = {},
@@ -455,45 +550,57 @@ $.extend($.ui.accordion, {
                        // fix width before calculating height of hidden element
                        var s = options.toShow;
                        originalWidth = s[0].style.width;
-                       s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) );
-                       
-                       $.each(fxAttrs, function(i, prop) {
-                               hideProps[prop] = 'hide';
-                               
-                               var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
-                               showProps[prop] = {
-                                       value: parts[1],
-                                       unit: parts[2] || 'px'
+                       s.width( parseInt( s.parent().width(), 10 )
+                               - parseInt( s.css( "paddingLeft" ), 10 )
+                               - parseInt( s.css( "paddingRight" ), 10 )
+                               - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 )
+                               - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) );
+
+                       $.each( fxAttrs, function( i, prop ) {
+                               hideProps[ prop ] = "hide";
+
+                               var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
+                               showProps[ prop ] = {
+                                       value: parts[ 1 ],
+                                       unit: parts[ 2 ] || "px"
                                };
                        });
-                       options.toShow.css({ height: 0, overflow: 'hidden' }).show();
-                       options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{
-                               step: function(now, settings) {
+                       options.toShow.css({ height: 0, overflow: "hidden" }).show();
+                       options.toHide
+                               .filter( ":hidden" )
+                                       .each( options.complete )
+                               .end()
+                               .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" ) {
                                                percentDone = ( settings.end - settings.start === 0 ) ? 0 :
-                                                       (settings.now - settings.start) / (settings.end - settings.start);
+                                                       ( settings.now - settings.start ) / ( settings.end - settings.start );
                                        }
-                                       
-                                       options.toShow[0].style[settings.prop] =
-                                               (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
+
+                                       options.toShow[ 0 ].style[ settings.prop ] =
+                                               ( percentDone * showProps[ settings.prop ].value )
+                                               + showProps[ settings.prop ].unit;
                                },
                                duration: options.duration,
                                easing: options.easing,
                                complete: function() {
                                        if ( !options.autoHeight ) {
-                                               options.toShow.css("height", "");
+                                               options.toShow.css( "height", "" );
                                        }
-                                       options.toShow.css("width", originalWidth);
-                                       options.toShow.css({overflow: overflow});
+                                       options.toShow.css({
+                                               width: originalWidth,
+                                               overflow: overflow
+                                       });
                                        options.complete();
                                }
                        });
                },
-               bounceslide: function(options) {
-                       this.slide(options, {
+               bounceslide: function( options ) {
+                       this.slide( options, {
                                easing: options.down ? "easeOutBounce" : "swing",
                                duration: options.down ? 1000 : 200
                        });
@@ -501,4 +608,4 @@ $.extend($.ui.accordion, {
        }
 });
 
-})(jQuery);
+})( jQuery );
index 9a12a6b..9342483 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Autocomplete 1.8.2
+ * jQuery UI Autocomplete 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Autocomplete
  *
  *     jquery.ui.widget.js
  *     jquery.ui.position.js
  */
-(function( $ ) {
+(function( $, undefined ) {
+
+// used to prevent race conditions with remote data sources
+var requestIndex = 0;
 
 $.widget( "ui.autocomplete", {
        options: {
+               appendTo: "body",
+               autoFocus: false,
+               delay: 300,
                minLength: 1,
-               delay: 300
+               position: {
+                       my: "left top",
+                       at: "left bottom",
+                       collision: "none"
+               },
+               source: null
        },
+
+       pending: 0,
+
        _create: function() {
                var self = this,
-                       doc = this.element[ 0 ].ownerDocument;
+                       doc = this.element[ 0 ].ownerDocument,
+                       suppressKeyPress;
+
                this.element
                        .addClass( "ui-autocomplete-input" )
                        .attr( "autocomplete", "off" )
@@ -32,6 +48,11 @@ $.widget( "ui.autocomplete", {
                                "aria-haspopup": "true"
                        })
                        .bind( "keydown.autocomplete", function( event ) {
+                               if ( self.options.disabled || self.element.attr( "readonly" ) ) {
+                                       return;
+                               }
+
+                               suppressKeyPress = false;
                                var keyCode = $.ui.keyCode;
                                switch( event.keyCode ) {
                                case keyCode.PAGE_UP:
@@ -52,8 +73,11 @@ $.widget( "ui.autocomplete", {
                                        break;
                                case keyCode.ENTER:
                                case keyCode.NUMPAD_ENTER:
-                                       // when menu is open or has focus
+                                       // when menu is open and has focus
                                        if ( self.menu.active ) {
+                                               // #6055 - Opera still allows the keypress to occur
+                                               // which causes forms to submit
+                                               suppressKeyPress = true;
                                                event.preventDefault();
                                        }
                                        //passthrough - ENTER and TAB both select the current element
@@ -67,33 +91,38 @@ $.widget( "ui.autocomplete", {
                                        self.element.val( self.term );
                                        self.close( event );
                                        break;
-                               case keyCode.LEFT:
-                               case keyCode.RIGHT:
-                               case keyCode.SHIFT:
-                               case keyCode.CONTROL:
-                               case keyCode.ALT:
-                               case keyCode.COMMAND:
-                               case keyCode.COMMAND_RIGHT:
-                               case keyCode.INSERT:
-                               case keyCode.CAPS_LOCK:
-                               case keyCode.END:
-                               case keyCode.HOME:
-                                       // ignore metakeys (shift, ctrl, alt)
-                                       break;
                                default:
                                        // keypress is triggered before the input value is changed
                                        clearTimeout( self.searching );
                                        self.searching = setTimeout(function() {
-                                               self.search( null, event );
+                                               // only search if the value has changed
+                                               if ( self.term != self.element.val() ) {
+                                                       self.selectedItem = null;
+                                                       self.search( null, event );
+                                               }
                                        }, self.options.delay );
                                        break;
                                }
                        })
+                       .bind( "keypress.autocomplete", function( event ) {
+                               if ( suppressKeyPress ) {
+                                       suppressKeyPress = false;
+                                       event.preventDefault();
+                               }
+                       })
                        .bind( "focus.autocomplete", function() {
+                               if ( self.options.disabled ) {
+                                       return;
+                               }
+
                                self.selectedItem = null;
                                self.previous = self.element.val();
                        })
                        .bind( "blur.autocomplete", function( event ) {
+                               if ( self.options.disabled ) {
+                                       return;
+                               }
+
                                clearTimeout( self.searching );
                                // clicks on the menu (or a button to trigger a search) will cause a blur event
                                self.closing = setTimeout(function() {
@@ -107,9 +136,26 @@ $.widget( "ui.autocomplete", {
                };
                this.menu = $( "<ul></ul>" )
                        .addClass( "ui-autocomplete" )
-                       .appendTo( "body", doc )
+                       .appendTo( $( this.options.appendTo || "body", doc )[0] )
                        // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
-                       .mousedown(function() {
+                       .mousedown(function( event ) {
+                               // clicking on the scrollbar causes focus to shift to the body
+                               // but we can't detect a mouseup or a click immediately afterward
+                               // so we have to track the next mousedown and close the menu if
+                               // the user clicks somewhere outside of the autocomplete
+                               var menuElement = self.menu.element[ 0 ];
+                               if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+                                       setTimeout(function() {
+                                               $( document ).one( 'mousedown', function( event ) {
+                                                       if ( event.target !== self.element[ 0 ] &&
+                                                               event.target !== menuElement &&
+                                                               !$.ui.contains( menuElement, event.target ) ) {
+                                                               self.close();
+                                                       }
+                                               });
+                                       }, 1 );
+                               }
+
                                // use another timeout to make sure the blur-event-handler on the input was already triggered
                                setTimeout(function() {
                                        clearTimeout( self.closing );
@@ -118,7 +164,7 @@ $.widget( "ui.autocomplete", {
                        .menu({
                                focus: function( event, ui ) {
                                        var item = ui.item.data( "item.autocomplete" );
-                                       if ( false !== self._trigger( "focus", null, { item: item } ) ) {
+                                       if ( false !== self._trigger( "focus", event, { item: item } ) ) {
                                                // use value to match what will end up in the input, if it was a key event
                                                if ( /^key/.test(event.originalEvent.type) ) {
                                                        self.element.val( item.value );
@@ -126,21 +172,37 @@ $.widget( "ui.autocomplete", {
                                        }
                                },
                                selected: function( event, ui ) {
-                                       var item = ui.item.data( "item.autocomplete" );
-                                       if ( false !== self._trigger( "select", event, { item: item } ) ) {
-                                               self.element.val( item.value );
-                                       }
-                                       self.close( event );
+                                       var item = ui.item.data( "item.autocomplete" ),
+                                               previous = self.previous;
+
                                        // only trigger when focus was lost (click on menu)
-                                       var previous = self.previous;
                                        if ( self.element[0] !== doc.activeElement ) {
                                                self.element.focus();
                                                self.previous = previous;
+                                               // #6109 - IE triggers two focus events and the second
+                                               // is asynchronous, so we need to reset the previous
+                                               // term synchronously and asynchronously :-(
+                                               setTimeout(function() {
+                                                       self.previous = previous;
+                                                       self.selectedItem = item;
+                                               }, 1);
                                        }
+
+                                       if ( false !== self._trigger( "select", event, { item: item } ) ) {
+                                               self.element.val( item.value );
+                                       }
+                                       // reset the term after the select event
+                                       // this allows custom select handling to work properly
+                                       self.term = self.element.val();
+
+                                       self.close( event );
                                        self.selectedItem = item;
                                },
                                blur: function( event, ui ) {
-                                       if ( self.menu.element.is(":visible") ) {
+                                       // don't set the value of the text field if it's already correct
+                                       // this prevents moving the cursor unnecessarily
+                                       if ( self.menu.element.is(":visible") &&
+                                               ( self.element.val() !== self.term ) ) {
                                                self.element.val( self.term );
                                        }
                                }
@@ -166,15 +228,22 @@ $.widget( "ui.autocomplete", {
                $.Widget.prototype.destroy.call( this );
        },
 
-       _setOption: function( key ) {
+       _setOption: function( key, value ) {
                $.Widget.prototype._setOption.apply( this, arguments );
                if ( key === "source" ) {
                        this._initSource();
                }
+               if ( key === "appendTo" ) {
+                       this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
+               }
+               if ( key === "disabled" && value && this.xhr ) {
+                       this.xhr.abort();
+               }
        },
 
        _initSource: function() {
-               var array,
+               var self = this,
+                       array,
                        url;
                if ( $.isArray(this.options.source) ) {
                        array = this.options.source;
@@ -184,7 +253,25 @@ $.widget( "ui.autocomplete", {
                } else if ( typeof this.options.source === "string" ) {
                        url = this.options.source;
                        this.source = function( request, response ) {
-                               $.getJSON( url, request, response );
+                               if ( self.xhr ) {
+                                       self.xhr.abort();
+                               }
+                               self.xhr = $.ajax({
+                                       url: url,
+                                       data: request,
+                                       dataType: "json",
+                                       autocompleteRequest: ++requestIndex,
+                                       success: function( data, status ) {
+                                               if ( this.autocompleteRequest === requestIndex ) {
+                                                       response( data );
+                                               }
+                                       },
+                                       error: function() {
+                                               if ( this.autocompleteRequest === requestIndex ) {
+                                                       response( [] );
+                                               }
+                                       }
+                               });
                        };
                } else {
                        this.source = this.options.source;
@@ -193,12 +280,16 @@ $.widget( "ui.autocomplete", {
 
        search: function( value, event ) {
                value = value != null ? value : this.element.val();
+
+               // always save the actual value, not the one passed as an argument
+               this.term = this.element.val();
+
                if ( value.length < this.options.minLength ) {
                        return this.close( event );
                }
 
                clearTimeout( this.closing );
-               if ( this._trigger("search") === false ) {
+               if ( this._trigger( "search", event ) === false ) {
                        return;
                }
 
@@ -206,31 +297,32 @@ $.widget( "ui.autocomplete", {
        },
 
        _search: function( value ) {
-               this.term = this.element
-                       .addClass( "ui-autocomplete-loading" )
-                       // always save the actual value, not the one passed as an argument
-                       .val();
+               this.pending++;
+               this.element.addClass( "ui-autocomplete-loading" );
 
                this.source( { term: value }, this.response );
        },
 
        _response: function( content ) {
-               if ( content.length ) {
+               if ( !this.options.disabled && content && content.length ) {
                        content = this._normalize( content );
                        this._suggest( content );
                        this._trigger( "open" );
                } else {
                        this.close();
                }
-               this.element.removeClass( "ui-autocomplete-loading" );
+               this.pending--;
+               if ( !this.pending ) {
+                       this.element.removeClass( "ui-autocomplete-loading" );
+               }
        },
 
        close: function( event ) {
                clearTimeout( this.closing );
                if ( this.menu.element.is(":visible") ) {
-                       this._trigger( "close", event );
                        this.menu.element.hide();
                        this.menu.deactivate();
+                       this._trigger( "close", event );
                }
        },
        
@@ -261,26 +353,33 @@ $.widget( "ui.autocomplete", {
 
        _suggest: function( items ) {
                var ul = this.menu.element
-                               .empty()
-                               .zIndex( this.element.zIndex() + 1 ),
-                       menuWidth,
-                       textWidth;
+                       .empty()
+                       .zIndex( this.element.zIndex() + 1 );
                this._renderMenu( ul, items );
                // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
                this.menu.deactivate();
                this.menu.refresh();
-               this.menu.element.show().position({
-                       my: "left top",
-                       at: "left bottom",
-                       of: this.element,
-                       collision: "none"
-               });
 
-               menuWidth = ul.width( "" ).width();
-               textWidth = this.element.width();
-               ul.width( Math.max( menuWidth, textWidth ) );
+               // size and position menu
+               ul.show();
+               this._resizeMenu();
+               ul.position( $.extend({
+                       of: this.element
+               }, this.options.position ));
+
+               if ( this.options.autoFocus ) {
+                       this.menu.next( new $.Event("mouseover") );
+               }
        },
-       
+
+       _resizeMenu: function() {
+               var ul = this.menu.element;
+               ul.outerWidth( Math.max(
+                       ul.width( "" ).outerWidth(),
+                       this.element.outerWidth()
+               ) );
+       },
+
        _renderMenu: function( ul, items ) {
                var self = this;
                $.each( items, function( index, item ) {
@@ -291,7 +390,7 @@ $.widget( "ui.autocomplete", {
        _renderItem: function( ul, item) {
                return $( "<li></li>" )
                        .data( "item.autocomplete", item )
-                       .append( "<a>" + item.label + "</a>" )
+                       .append( $( "<a></a>" ).text( item.label ) )
                        .appendTo( ul );
        },
 
@@ -316,7 +415,7 @@ $.widget( "ui.autocomplete", {
 
 $.extend( $.ui.autocomplete, {
        escapeRegex: function( value ) {
-               return value.replace( /([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1" );
+               return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
        },
        filter: function(array, term) {
                var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
@@ -335,9 +434,9 @@ $.extend( $.ui.autocomplete, {
  * it for the next release. You're welcome to give it a try anyway and give us feedback,
  * as long as you're okay with migrating your code later on. We can help with that, too.
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Menu
  *
@@ -395,7 +494,7 @@ $.widget("ui.menu", {
                                elementHeight = this.element.height();
                        if (offset < 0) {
                                this.element.attr("scrollTop", scroll + offset);
-                       } else if (offset > elementHeight) {
+                       } else if (offset >= elementHeight) {
                                this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
                        }
                }
@@ -426,11 +525,11 @@ $.widget("ui.menu", {
        },
 
        first: function() {
-               return this.active && !this.active.prev().length;
+               return this.active && !this.active.prevAll(".ui-menu-item").length;
        },
 
        last: function() {
-               return this.active && !this.active.next().length;
+               return this.active && !this.active.nextAll(".ui-menu-item").length;
        },
 
        move: function(direction, edge, event) {
@@ -451,12 +550,12 @@ $.widget("ui.menu", {
                if (this.hasScroll()) {
                        // TODO merge with no-scroll-else
                        if (!this.active || this.last()) {
-                               this.activate(event, this.element.children(":first"));
+                               this.activate(event, this.element.children(".ui-menu-item:first"));
                                return;
                        }
                        var base = this.active.offset().top,
                                height = this.element.height(),
-                               result = this.element.children("li").filter(function() {
+                               result = this.element.children(".ui-menu-item").filter(function() {
                                        var close = $(this).offset().top - base - height + $(this).height();
                                        // TODO improve approximation
                                        return close < 10 && close > -10;
@@ -464,11 +563,12 @@ $.widget("ui.menu", {
 
                        // TODO try to catch this earlier when scrollTop indicates the last page anyway
                        if (!result.length) {
-                               result = this.element.children(":last");
+                               result = this.element.children(".ui-menu-item:last");
                        }
                        this.activate(event, result);
                } else {
-                       this.activate(event, this.element.children(!this.active || this.last() ? ":first" : ":last"));
+                       this.activate(event, this.element.children(".ui-menu-item")
+                               .filter(!this.active || this.last() ? ":first" : ":last"));
                }
        },
 
@@ -477,13 +577,13 @@ $.widget("ui.menu", {
                if (this.hasScroll()) {
                        // TODO merge with no-scroll-else
                        if (!this.active || this.first()) {
-                               this.activate(event, this.element.children(":last"));
+                               this.activate(event, this.element.children(".ui-menu-item:last"));
                                return;
                        }
 
                        var base = this.active.offset().top,
                                height = this.element.height();
-                               result = this.element.children("li").filter(function() {
+                               result = this.element.children(".ui-menu-item").filter(function() {
                                        var close = $(this).offset().top - base + height - $(this).height();
                                        // TODO improve approximation
                                        return close < 10 && close > -10;
@@ -491,11 +591,12 @@ $.widget("ui.menu", {
 
                        // TODO try to catch this earlier when scrollTop indicates the last page anyway
                        if (!result.length) {
-                               result = this.element.children(":first");
+                               result = this.element.children(".ui-menu-item:first");
                        }
                        this.activate(event, result);
                } else {
-                       this.activate(event, this.element.children(!this.active || this.first() ? ":last" : ":first"));
+                       this.activate(event, this.element.children(".ui-menu-item")
+                               .filter(!this.active || this.first() ? ":last" : ":first"));
                }
        },
 
index d318e3d..9a70a01 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Button 1.8.2
+ * jQuery UI Button 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Button
  *
  *     jquery.ui.core.js
  *     jquery.ui.widget.js
  */
-(function( $ ) {
+(function( $, undefined ) {
 
 var lastActive,
        baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
        stateClasses = "ui-state-hover ui-state-active ",
-       typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only",
+       typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
        formResetHandler = function( event ) {
                $( ":ui-button", event.target.form ).each(function() {
                        var inst = $( this ).data( "button" );
@@ -44,6 +44,7 @@ var lastActive,
 
 $.widget( "ui.button", {
        options: {
+               disabled: null,
                text: true,
                label: null,
                icons: {
@@ -56,6 +57,10 @@ $.widget( "ui.button", {
                        .unbind( "reset.button" )
                        .bind( "reset.button", formResetHandler );
 
+               if ( typeof this.options.disabled !== "boolean" ) {
+                       this.options.disabled = this.element.attr( "disabled" );
+               }
+
                this._determineButtonType();
                this.hasTitle = !!this.buttonElement.attr( "title" );
 
@@ -195,8 +200,16 @@ $.widget( "ui.button", {
                if ( this.type === "checkbox" || this.type === "radio" ) {
                        // we don't search against the document in case the element
                        // is disconnected from the DOM
-                       this.buttonElement = this.element.parents().last()
-                               .find( "[for=" + this.element.attr("id") + "]" );
+                       var ancestor = this.element.parents().filter(":last"),
+                               labelSelector = "label[for=" + this.element.attr("id") + "]";
+                       this.buttonElement = ancestor.find( labelSelector );
+                       if ( !this.buttonElement.length ) {
+                               ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+                               this.buttonElement = ancestor.filter( labelSelector );
+                               if ( !this.buttonElement.length ) {
+                                       this.buttonElement = ancestor.find( labelSelector );
+                               }
+                       }
                        this.element.addClass( "ui-helper-hidden-accessible" );
 
                        var checked = this.element.is( ":checked" );
@@ -285,34 +298,43 @@ $.widget( "ui.button", {
                                .appendTo( buttonElement.empty() )
                                .text(),
                        icons = this.options.icons,
-                       multipleIcons = icons.primary && icons.secondary;
+                       multipleIcons = icons.primary && icons.secondary,
+                       buttonClasses = [];  
+
                if ( icons.primary || icons.secondary ) {
-                       buttonElement.addClass( "ui-button-text-icon" +
-                               ( multipleIcons ? "s" : "" ) );
+                       if ( this.options.text ) {
+                               buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+                       }
+
                        if ( icons.primary ) {
                                buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
                        }
+
                        if ( icons.secondary ) {
                                buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
                        }
+
                        if ( !this.options.text ) {
-                               buttonElement
-                                       .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
-                                       .removeClass( "ui-button-text-icons ui-button-text-icon" );
+                               buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
                                if ( !this.hasTitle ) {
                                        buttonElement.attr( "title", buttonText );
                                }
                        }
                } else {
-                       buttonElement.addClass( "ui-button-text-only" );
+                       buttonClasses.push( "ui-button-text-only" );
                }
+               buttonElement.addClass( buttonClasses.join( " " ) );
        }
 });
 
 $.widget( "ui.buttonset", {
+       options: {
+               items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
+       },
+
        _create: function() {
                this.element.addClass( "ui-buttonset" );
-               this._init();
        },
        
        _init: function() {
@@ -328,7 +350,7 @@ $.widget( "ui.buttonset", {
        },
        
        refresh: function() {
-               this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
+               this.buttons = this.element.find( this.options.items )
                        .filter( ":ui-button" )
                                .button( "refresh" )
                        .end()
index 8044802..4589a47 100644 (file)
@@ -1,82 +1,24 @@
 /*!
- * jQuery UI 1.8.2
+ * jQuery UI 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI
  */
-
-(function($) {
+(function( $, undefined ) {
 
 // prevent duplicate loading
 // this is only a problem because we proxy existing functions
 // and we don't want to double proxy them
 $.ui = $.ui || {};
-if ($.ui.version) {
+if ( $.ui.version ) {
        return;
 }
 
-//Helper functions and ui object
-$.extend($.ui, {
-       version: "1.8.2",
-
-       // $.ui.plugin is deprecated.  Use the proxy pattern instead.
-       plugin: {
-               add: function(module, option, set) {
-                       var proto = $.ui[module].prototype;
-                       for(var i in set) {
-                               proto.plugins[i] = proto.plugins[i] || [];
-                               proto.plugins[i].push([option, set[i]]);
-                       }
-               },
-               call: function(instance, name, args) {
-                       var set = instance.plugins[name];
-                       if(!set || !instance.element[0].parentNode) { return; }
-
-                       for (var i = 0; i < set.length; i++) {
-                               if (instance.options[set[i][0]]) {
-                                       set[i][1].apply(instance.element, args);
-                               }
-                       }
-               }
-       },
-
-       contains: function(a, b) {
-               return document.compareDocumentPosition
-                       ? a.compareDocumentPosition(b) & 16
-                       : a !== b && a.contains(b);
-       },
-
-       hasScroll: function(el, a) {
-
-               //If overflow is hidden, the element might have extra content, but the user wants to hide it
-               if ($(el).css('overflow') == 'hidden') { return false; }
-
-               var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
-                       has = false;
-
-               if (el[scroll] > 0) { return true; }
-
-               // TODO: determine which cases actually cause this to happen
-               // if the element doesn't have the scroll set, see if it's possible to
-               // set the scroll
-               el[scroll] = 1;
-               has = (el[scroll] > 0);
-               el[scroll] = 0;
-               return has;
-       },
-
-       isOverAxis: function(x, reference, size) {
-               //Determines when x coordinate is over "b" element axis
-               return (x > reference) && (x < (reference + size));
-       },
-
-       isOver: function(y, x, top, left, height, width) {
-               //Determines when x, y coordinates is over "b" element
-               return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
-       },
+$.extend( $.ui, {
+       version: "1.8.11",
 
        keyCode: {
                ALT: 18,
@@ -114,36 +56,26 @@ $.extend($.ui, {
        }
 });
 
-//jQuery plugins
+// plugins
 $.fn.extend({
        _focus: $.fn.focus,
-       focus: function(delay, fn) {
-               return typeof delay === 'number'
-                       this.each(function() {
+       focus: function( delay, fn ) {
+               return typeof delay === "number" ?
+                       this.each(function() {
                                var elem = this;
                                setTimeout(function() {
-                                       $(elem).focus();
-                                       (fn && fn.call(elem));
-                               }, delay);
-                       })
-                       : this._focus.apply(this, arguments);
-       },
-       
-       enableSelection: function() {
-               return this
-                       .attr('unselectable', 'off')
-                       .css('MozUserSelect', '');
-       },
-
-       disableSelection: function() {
-               return this
-                       .attr('unselectable', 'on')
-                       .css('MozUserSelect', 'none');
+                                       $( elem ).focus();
+                                       if ( fn ) {
+                                               fn.call( elem );
+                                       }
+                               }, delay );
+                       }) :
+                       this._focus.apply( this, arguments );
        },
 
        scrollParent: function() {
                var scrollParent;
-               if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+               if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
                        scrollParent = this.parents().filter(function() {
                                return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
                        }).eq(0);
@@ -156,26 +88,25 @@ $.fn.extend({
                return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
        },
 
-       zIndex: function(zIndex) {
-               if (zIndex !== undefined) {
-                       return this.css('zIndex', zIndex);
+       zIndex: function( zIndex ) {
+               if ( zIndex !== undefined ) {
+                       return this.css( "zIndex", zIndex );
                }
-               
-               if (this.length) {
-                       var elem = $(this[0]), position, value;
-                       while (elem.length && elem[0] !== document) {
+
+               if ( this.length ) {
+                       var elem = $( this[ 0 ] ), position, value;
+                       while ( elem.length && elem[ 0 ] !== document ) {
                                // Ignore z-index if position is set to a value where z-index is ignored by the browser
                                // This makes behavior of this function consistent across browsers
                                // WebKit always returns auto if the element is positioned
-                               position = elem.css('position');
-                               if (position == 'absolute' || position == 'relative' || position == 'fixed')
-                               {
+                               position = elem.css( "position" );
+                               if ( position === "absolute" || position === "relative" || position === "fixed" ) {
                                        // IE returns 0 when zIndex is not specified
                                        // other browsers return a string
                                        // we ignore the case of nested elements with an explicit value of 0
                                        // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
-                                       value = parseInt(elem.css('zIndex'));
-                                       if (!isNaN(value) && value != 0) {
+                                       value = parseInt( elem.css( "zIndex" ), 10 );
+                                       if ( !isNaN( value ) && value !== 0 ) {
                                                return value;
                                        }
                                }
@@ -184,33 +115,194 @@ $.fn.extend({
                }
 
                return 0;
+       },
+
+       disableSelection: function() {
+               return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
+                       ".ui-disableSelection", function( event ) {
+                               event.preventDefault();
+                       });
+       },
+
+       enableSelection: function() {
+               return this.unbind( ".ui-disableSelection" );
+       }
+});
+
+$.each( [ "Width", "Height" ], function( i, name ) {
+       var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+               type = name.toLowerCase(),
+               orig = {
+                       innerWidth: $.fn.innerWidth,
+                       innerHeight: $.fn.innerHeight,
+                       outerWidth: $.fn.outerWidth,
+                       outerHeight: $.fn.outerHeight
+               };
+
+       function reduce( elem, size, border, margin ) {
+               $.each( side, function() {
+                       size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
+                       if ( border ) {
+                               size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
+                       }
+                       if ( margin ) {
+                               size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
+                       }
+               });
+               return size;
        }
+
+       $.fn[ "inner" + name ] = function( size ) {
+               if ( size === undefined ) {
+                       return orig[ "inner" + name ].call( this );
+               }
+
+               return this.each(function() {
+                       $( this ).css( type, reduce( this, size ) + "px" );
+               });
+       };
+
+       $.fn[ "outer" + name] = function( size, margin ) {
+               if ( typeof size !== "number" ) {
+                       return orig[ "outer" + name ].call( this, size );
+               }
+
+               return this.each(function() {
+                       $( this).css( type, reduce( this, size, true, margin ) + "px" );
+               });
+       };
 });
 
+// selectors
+function visible( element ) {
+       return !$( element ).parents().andSelf().filter(function() {
+               return $.curCSS( this, "visibility" ) === "hidden" ||
+                       $.expr.filters.hidden( this );
+       }).length;
+}
 
-//Additional selectors
-$.extend($.expr[':'], {
-       data: function(elem, i, match) {
-               return !!$.data(elem, match[3]);
+$.extend( $.expr[ ":" ], {
+       data: function( elem, i, match ) {
+               return !!$.data( elem, match[ 3 ] );
        },
 
-       focusable: function(element) {
+       focusable: function( element ) {
                var nodeName = element.nodeName.toLowerCase(),
-                       tabIndex = $.attr(element, 'tabindex');
-               return (/input|select|textarea|button|object/.test(nodeName)
+                       tabIndex = $.attr( element, "tabindex" );
+               if ( "area" === nodeName ) {
+                       var map = element.parentNode,
+                               mapName = map.name,
+                               img;
+                       if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+                               return false;
+                       }
+                       img = $( "img[usemap=#" + mapName + "]" )[0];
+                       return !!img && visible( img );
+               }
+               return ( /input|select|textarea|button|object/.test( nodeName )
                        ? !element.disabled
-                       : 'a' == nodeName || 'area' == nodeName
-                               ? element.href || !isNaN(tabIndex)
-                               : !isNaN(tabIndex))
+                       : "a" == nodeName
+                               ? element.href || !isNaN( tabIndex )
+                               : !isNaN( tabIndex ))
                        // the element and all of its ancestors must be visible
-                       // the browser may report that the area is hidden
-                       && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
+                       && visible( element );
        },
 
-       tabbable: function(element) {
-               var tabIndex = $.attr(element, 'tabindex');
-               return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
+       tabbable: function( element ) {
+               var tabIndex = $.attr( element, "tabindex" );
+               return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
+       }
+});
+
+// support
+$(function() {
+       var body = document.body,
+               div = body.appendChild( div = document.createElement( "div" ) );
+
+       $.extend( div.style, {
+               minHeight: "100px",
+               height: "auto",
+               padding: 0,
+               borderWidth: 0
+       });
+
+       $.support.minHeight = div.offsetHeight === 100;
+       $.support.selectstart = "onselectstart" in div;
+
+       // set display to none to avoid a layout bug in IE
+       // http://dev.jquery.com/ticket/4014
+       body.removeChild( div ).style.display = "none";
+});
+
+
+
+
+
+// deprecated
+$.extend( $.ui, {
+       // $.ui.plugin is deprecated.  Use the proxy pattern instead.
+       plugin: {
+               add: function( module, option, set ) {
+                       var proto = $.ui[ module ].prototype;
+                       for ( var i in set ) {
+                               proto.plugins[ i ] = proto.plugins[ i ] || [];
+                               proto.plugins[ i ].push( [ option, set[ i ] ] );
+                       }
+               },
+               call: function( instance, name, args ) {
+                       var set = instance.plugins[ name ];
+                       if ( !set || !instance.element[ 0 ].parentNode ) {
+                               return;
+                       }
+       
+                       for ( var i = 0; i < set.length; i++ ) {
+                               if ( instance.options[ set[ i ][ 0 ] ] ) {
+                                       set[ i ][ 1 ].apply( instance.element, args );
+                               }
+                       }
+               }
+       },
+       
+       // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
+       contains: function( a, b ) {
+               return document.compareDocumentPosition ?
+                       a.compareDocumentPosition( b ) & 16 :
+                       a !== b && a.contains( b );
+       },
+       
+       // only used by resizable
+       hasScroll: function( el, a ) {
+       
+               //If overflow is hidden, the element might have extra content, but the user wants to hide it
+               if ( $( el ).css( "overflow" ) === "hidden") {
+                       return false;
+               }
+       
+               var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
+                       has = false;
+       
+               if ( el[ scroll ] > 0 ) {
+                       return true;
+               }
+       
+               // TODO: determine which cases actually cause this to happen
+               // if the element doesn't have the scroll set, see if it's possible to
+               // set the scroll
+               el[ scroll ] = 1;
+               has = ( el[ scroll ] > 0 );
+               el[ scroll ] = 0;
+               return has;
+       },
+       
+       // these are odd functions, fix the API or move into individual plugins
+       isOverAxis: function( x, reference, size ) {
+               //Determines when x coordinate is over "b" element axis
+               return ( x > reference ) && ( x < ( reference + size ) );
+       },
+       isOver: function( y, x, top, left, height, width ) {
+               //Determines when x, y coordinates is over "b" element
+               return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
        }
 });
 
-})(jQuery);
+})( jQuery );
index cad1d58..06d481e 100644 (file)
@@ -1,19 +1,18 @@
 /*
- * jQuery UI Datepicker 1.8.2
+ * jQuery UI Datepicker 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Datepicker
  *
  * Depends:
  *     jquery.ui.core.js
  */
+(function( $, undefined ) {
 
-(function($) { // hide the namespace
-
-$.extend($.ui, { datepicker: { version: "1.8.2" } });
+$.extend($.ui, { datepicker: { version: "1.8.11" } });
 
 var PROP_NAME = 'datepicker';
 var dpuuid = new Date().getTime();
@@ -108,7 +107,7 @@ function Datepicker() {
                autoSize: false // True to size the input for the date format, false to leave as is
        };
        $.extend(this._defaults, this.regional['']);
-       this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
+       this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>');
 }
 
 $.extend(Datepicker.prototype, {
@@ -168,7 +167,7 @@ $.extend(Datepicker.prototype, {
 
        /* Create a new instance object. */
        _newInst: function(target, inline) {
-               var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars
+               var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
                return {id: id, input: target, // associated target
                        selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
                        drawMonth: 0, drawYear: 0, // month being drawn
@@ -273,6 +272,7 @@ $.extend(Datepicker.prototype, {
                this._setDate(inst, this._getDefaultDate(inst), true);
                this._updateDatepicker(inst);
                this._updateAlternate(inst);
+               inst.dpDiv.show();
        },
 
        /* Pop-up the date picker in a "dialog" box.
@@ -444,7 +444,14 @@ $.extend(Datepicker.prototype, {
                                this._hideDatepicker();
                        }
                        var date = this._getDateDatepicker(target, true);
+                       var minDate = this._getMinMaxDate(inst, 'min');
+                       var maxDate = this._getMinMaxDate(inst, 'max');
                        extendRemove(inst.settings, settings);
+                       // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
+                       if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
+                               inst.settings.minDate = this._formatDate(inst, minDate);
+                       if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
+                               inst.settings.maxDate = this._formatDate(inst, maxDate);
                        this._attachments($(target), inst);
                        this._autoSize(inst);
                        this._setDateDatepicker(target, date);
@@ -500,8 +507,8 @@ $.extend(Datepicker.prototype, {
                                case 9: $.datepicker._hideDatepicker();
                                                handled = false;
                                                break; // hide on tab out
-                               case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).
-                                                       add($('td.' + $.datepicker._currentClass, inst.dpDiv));
+                               case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + 
+                                                                       $.datepicker._currentClass + ')', inst.dpDiv);
                                                if (sel[0])
                                                        $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
                                                else
@@ -565,7 +572,7 @@ $.extend(Datepicker.prototype, {
                if ($.datepicker._get(inst, 'constrainInput')) {
                        var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
                        var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
-                       return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
+                       return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
                }
        },
 
@@ -625,6 +632,8 @@ $.extend(Datepicker.prototype, {
                }
                var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
                $.datepicker._pos = null;
+               //to avoid flashes on Firefox
+               inst.dpDiv.empty();
                // determine sizing offscreen
                inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
                $.datepicker._updateDatepicker(inst);
@@ -639,10 +648,12 @@ $.extend(Datepicker.prototype, {
                        var duration = $.datepicker._get(inst, 'duration');
                        var postProcess = function() {
                                $.datepicker._datepickerShowing = true;
-                               var borders = $.datepicker._getBorders(inst.dpDiv);
-                               inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only
-                                       css({left: -borders[0], top: -borders[1],
+                               var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+                               if( !! cover.length ){
+                                       var borders = $.datepicker._getBorders(inst.dpDiv);
+                                       cover.css({left: -borders[0], top: -borders[1],
                                                width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
+                               }
                        };
                        inst.dpDiv.zIndex($(input).zIndex()+1);
                        if ($.effects && $.effects[showAnim])
@@ -661,12 +672,12 @@ $.extend(Datepicker.prototype, {
        _updateDatepicker: function(inst) {
                var self = this;
                var borders = $.datepicker._getBorders(inst.dpDiv);
-               inst.dpDiv.empty().append(this._generateHTML(inst))
-                       .find('iframe.ui-datepicker-cover') // IE6- only
-                               .css({left: -borders[0], top: -borders[1],
-                                       width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
-                       .end()
-                       .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
+               inst.dpDiv.empty().append(this._generateHTML(inst));
+               var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+               if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
+                       cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
+               }
+               inst.dpDiv.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
                                .bind('mouseout', function(){
                                        $(this).removeClass('ui-state-hover');
                                        if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
@@ -696,8 +707,21 @@ $.extend(Datepicker.prototype, {
                inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
                        'Class']('ui-datepicker-rtl');
                if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
-                               inst.input.is(':visible') && !inst.input.is(':disabled'))
+                               // #6694 - don't focus the input if it's already focused
+                               // this breaks the change event in IE
+                               inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
                        inst.input.focus();
+               // deffered render of the years select (to avoid flashes on Firefox) 
+               if( inst.yearshtml ){
+                       var origyearshtml = inst.yearshtml;
+                       setTimeout(function(){
+                               //assure that inst.yearshtml didn't change.
+                               if( origyearshtml === inst.yearshtml ){
+                                       inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
+                               }
+                               origyearshtml = inst.yearshtml = null;
+                       }, 0);
+               }
        },
 
        /* Retrieve the size of left and top borders for an element.
@@ -737,7 +761,7 @@ $.extend(Datepicker.prototype, {
        _findPos: function(obj) {
                var inst = this._getInst(obj);
                var isRTL = this._get(inst, 'isRTL');
-        while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
+        while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
             obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
         }
         var position = $(obj).offset();
@@ -847,8 +871,11 @@ $.extend(Datepicker.prototype, {
        _clickMonthYear: function(id) {
                var target = $(id);
                var inst = this._getInst(target[0]);
-               if (inst.input && inst._selectingMonthYear && !$.browser.msie)
-                       inst.input.focus();
+               if (inst.input && inst._selectingMonthYear) {
+                       setTimeout(function() {
+                               inst.input.focus();
+                       }, 0);
+               }
                inst._selectingMonthYear = !inst._selectingMonthYear;
        },
 
@@ -948,6 +975,8 @@ $.extend(Datepicker.prototype, {
                if (value == '')
                        return null;
                var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
+               shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+                               new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
                var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
                var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
                var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
@@ -966,9 +995,9 @@ $.extend(Datepicker.prototype, {
                };
                // Extract a number from the string value
                var getNumber = function(match) {
-                       lookAhead(match);
+                       var isDoubled = lookAhead(match);
                        var size = (match == '@' ? 14 : (match == '!' ? 20 :
-                               (match == 'y' ? 4 : (match == 'o' ? 3 : 2))));
+                               (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
                        var digits = new RegExp('^\\d{1,' + size + '}');
                        var num = value.substring(iValue).match(digits);
                        if (!num)
@@ -980,7 +1009,7 @@ $.extend(Datepicker.prototype, {
                var getName = function(match, shortNames, longNames) {
                        var names = (lookAhead(match) ? longNames : shortNames);
                        for (var i = 0; i < names.length; i++) {
-                               if (value.substr(iValue, names[i].length) == names[i]) {
+                               if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
                                        iValue += names[i].length;
                                        return i + 1;
                                }
@@ -1298,16 +1327,16 @@ $.extend(Datepicker.prototype, {
                        }
                        return new Date(year, month, day);
                };
-               date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :
-                       (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
-               date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
-               if (date) {
-                       date.setHours(0);
-                       date.setMinutes(0);
-                       date.setSeconds(0);
-                       date.setMilliseconds(0);
+               var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
+                       (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+               newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
+               if (newDate) {
+                       newDate.setHours(0);
+                       newDate.setMinutes(0);
+                       newDate.setSeconds(0);
+                       newDate.setMilliseconds(0);
                }
-               return this._daylightSavingAdjust(date);
+               return this._daylightSavingAdjust(newDate);
        },
 
        /* Handle switch to/from daylight saving.
@@ -1324,13 +1353,13 @@ $.extend(Datepicker.prototype, {
 
        /* Set the date(s) directly. */
        _setDate: function(inst, date, noChange) {
-               var clear = !(date);
+               var clear = !date;
                var origMonth = inst.selectedMonth;
                var origYear = inst.selectedYear;
-               date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
-               inst.selectedDay = inst.currentDay = date.getDate();
-               inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
-               inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
+               var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
+               inst.selectedDay = inst.currentDay = newDate.getDate();
+               inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
+               inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
                if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
                        this._notifyChange(inst);
                this._adjustInstDate(inst);
@@ -1546,6 +1575,7 @@ $.extend(Datepicker.prototype, {
                if (!showMonthAfterYear)
                        html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
                // year selection
+               inst.yearshtml = '';
                if (secondary || !changeYear)
                        html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
                else {
@@ -1562,16 +1592,24 @@ $.extend(Datepicker.prototype, {
                        var endYear = Math.max(year, determineYear(years[1] || ''));
                        year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
                        endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
-                       html += '<select class="ui-datepicker-year" ' +
+                       inst.yearshtml += '<select class="ui-datepicker-year" ' +
                                'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
                                'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
                                '>';
                        for (; year <= endYear; year++) {
-                               html += '<option value="' + year + '"' +
+                               inst.yearshtml += '<option value="' + year + '"' +
                                        (year == drawYear ? ' selected="selected"' : '') +
                                        '>' + year + '</option>';
                        }
-                       html += '</select>';
+                       inst.yearshtml += '</select>';
+                       //when showing there is no need for later update
+                       if( ! $.browser.mozilla ){
+                               html += inst.yearshtml;
+                               inst.yearshtml = null;
+                       } else {
+                               // will be replaced later with inst.yearshtml
+                               html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>';
+                       }
                }
                html += this._get(inst, 'yearSuffix');
                if (showMonthAfterYear)
@@ -1599,9 +1637,9 @@ $.extend(Datepicker.prototype, {
        _restrictMinMax: function(inst, date) {
                var minDate = this._getMinMaxDate(inst, 'min');
                var maxDate = this._getMinMaxDate(inst, 'max');
-               date = (minDate && date < minDate ? minDate : date);
-               date = (maxDate && date > maxDate ? maxDate : date);
-               return date;
+               var newDate = (minDate && date < minDate ? minDate : date);
+               newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
+               return newDate;
        },
 
        /* Notify change of month/year. */
@@ -1625,7 +1663,7 @@ $.extend(Datepicker.prototype, {
 
        /* Find the number of days in a given month. */
        _getDaysInMonth: function(year, month) {
-               return 32 - new Date(year, month, 32).getDate();
+               return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
        },
 
        /* Find the day of the week of the first of a month. */
@@ -1695,7 +1733,12 @@ function isArray(a) {
                     Object - settings for attaching new datepicker functionality
    @return  jQuery object */
 $.fn.datepicker = function(options){
-
+       
+       /* Verify an empty collection wasn't passed - Fixes #6976 */
+       if ( !this.length ) {
+               return this;
+       }
+       
        /* Initialise the date picker. */
        if (!$.datepicker.initialized) {
                $(document).mousedown($.datepicker._checkExternalClick).
@@ -1721,7 +1764,7 @@ $.fn.datepicker = function(options){
 $.datepicker = new Datepicker(); // singleton instance
 $.datepicker.initialized = false;
 $.datepicker.uuid = new Date().getTime();
-$.datepicker.version = "1.8.2";
+$.datepicker.version = "1.8.11";
 
 // Workaround for #4055
 // Add another global to avoid noConflict issues with inline event handlers
index 5f9b1f8..f0656a2 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Dialog 1.8.2
+ * jQuery UI Dialog 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Dialog
  *
  *     jquery.ui.position.js
  *     jquery.ui.resizable.js
  */
-(function($) {
+(function( $, undefined ) {
 
 var uiDialogClasses =
-       'ui-dialog ' +
-       'ui-widget ' +
-       'ui-widget-content ' +
-       'ui-corner-all ';
+               'ui-dialog ' +
+               'ui-widget ' +
+               'ui-widget-content ' +
+               'ui-corner-all ',
+       sizeRelatedOptions = {
+               buttons: true,
+               height: true,
+               maxHeight: true,
+               maxWidth: true,
+               minHeight: true,
+               minWidth: true,
+               width: true
+       },
+       resizableRelatedOptions = {
+               maxHeight: true,
+               maxWidth: true,
+               minHeight: true,
+               minWidth: true
+       };
 
 $.widget("ui.dialog", {
        options: {
@@ -39,7 +54,18 @@ $.widget("ui.dialog", {
                minHeight: 150,
                minWidth: 150,
                modal: false,
-               position: 'center',
+               position: {
+                       my: 'center',
+                       at: 'center',
+                       collision: 'fit',
+                       // ensure that the titlebar is never outside the document
+                       using: function(pos) {
+                               var topOffset = $(this).css(pos).offset().top;
+                               if (topOffset < 0) {
+                                       $(this).css('top', pos.top - topOffset);
+                               }
+                       }
+               },
                resizable: true,
                show: null,
                stack: true,
@@ -47,13 +73,19 @@ $.widget("ui.dialog", {
                width: 300,
                zIndex: 1000
        },
+
        _create: function() {
                this.originalTitle = this.element.attr('title');
+               // #5742 - .attr() might return a DOMElement
+               if ( typeof this.originalTitle !== "string" ) {
+                       this.originalTitle = "";
+               }
 
+               this.options.title = this.options.title || this.originalTitle;
                var self = this,
                        options = self.options,
 
-                       title = options.title || self.originalTitle || '&#160;',
+                       title = options.title || '&#160;',
                        titleId = $.ui.dialog.getTitleId(self.element),
 
                        uiDialog = (self.uiDialog = $('<div></div>'))
@@ -161,6 +193,7 @@ $.widget("ui.dialog", {
                        uiDialog.bgiframe();
                }
        },
+
        _init: function() {
                if ( this.options.autoOpen ) {
                        this.open();
@@ -187,14 +220,14 @@ $.widget("ui.dialog", {
 
                return self;
        },
-       
+
        widget: function() {
                return this.uiDialog;
        },
 
        close: function(event) {
                var self = this,
-                       maxZ;
+                       maxZ, thisZ;
                
                if (false === self._trigger('beforeClose', event)) {
                        return;
@@ -223,7 +256,10 @@ $.widget("ui.dialog", {
                        maxZ = 0;
                        $('.ui-dialog').each(function() {
                                if (this !== self.uiDialog[0]) {
-                                       maxZ = Math.max(maxZ, $(this).css('z-index'));
+                                       thisZ = $(this).css('z-index');
+                                       if(!isNaN(thisZ)) {
+                                               maxZ = Math.max(maxZ, thisZ);
+                                       }
                                }
                        });
                        $.ui.dialog.maxZ = maxZ;
@@ -242,12 +278,12 @@ $.widget("ui.dialog", {
                var self = this,
                        options = self.options,
                        saveScroll;
-               
+
                if ((options.modal && !force) ||
                        (!options.stack && !options.modal)) {
                        return self._trigger('focus', event);
                }
-               
+
                if (options.zIndex > $.ui.dialog.maxZ) {
                        $.ui.dialog.maxZ = options.zIndex;
                }
@@ -275,9 +311,6 @@ $.widget("ui.dialog", {
                        uiDialog = self.uiDialog;
 
                self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
-               if (uiDialog.next().length) {
-                       uiDialog.appendTo('body');
-               }
                self._size();
                self._position(options.position);
                uiDialog.show(options.show);
@@ -289,11 +322,11 @@ $.widget("ui.dialog", {
                                if (event.keyCode !== $.ui.keyCode.TAB) {
                                        return;
                                }
-       
+
                                var tabbables = $(':tabbable', this),
                                        first = tabbables.filter(':first'),
                                        last  = tabbables.filter(':last');
-       
+
                                if (event.target === last[0] && !event.shiftKey) {
                                        first.focus(1);
                                        return false;
@@ -306,15 +339,12 @@ $.widget("ui.dialog", {
 
                // set focus to the first tabbable element in the content area or the first button
                // if there are no tabbable elements, set focus on the dialog itself
-               $([])
-                       .add(uiDialog.find('.ui-dialog-content :tabbable:first'))
-                       .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
-                       .add(uiDialog)
-                       .filter(':first')
-                       .focus();
+               $(self.element.find(':tabbable').get().concat(
+                       uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
+                               uiDialog.get()))).eq(0).focus();
 
-               self._trigger('open');
                self._isOpen = true;
+               self._trigger('open');
 
                return self;
        },
@@ -327,7 +357,10 @@ $.widget("ui.dialog", {
                                        'ui-dialog-buttonpane ' +
                                        'ui-widget-content ' +
                                        'ui-helper-clearfix'
-                               );
+                               ),
+                       uiButtonSet = $( "<div></div>" )
+                               .addClass( "ui-dialog-buttonset" )
+                               .appendTo( uiDialogButtonPane );
 
                // if we already have a button pane, remove it
                self.uiDialog.find('.ui-dialog-buttonpane').remove();
@@ -338,11 +371,17 @@ $.widget("ui.dialog", {
                        });
                }
                if (hasButtons) {
-                       $.each(buttons, function(name, fn) {
+                       $.each(buttons, function(name, props) {
+                               props = $.isFunction( props ) ?
+                                       { click: props, text: name } :
+                                       props;
                                var button = $('<button type="button"></button>')
-                                       .text(name)
-                                       .click(function() { fn.apply(self.element[0], arguments); })
-                                       .appendTo(uiDialogButtonPane);
+                                       .attr( props, true )
+                                       .unbind('click')
+                                       .click(function() {
+                                               props.click.apply(self.element[0], arguments);
+                                       })
+                                       .appendTo(uiButtonSet);
                                if ($.fn.button) {
                                        button.button();
                                }
@@ -450,40 +489,34 @@ $.widget("ui.dialog", {
                        offset = [0, 0],
                        isVisible;
 
-               position = position || $.ui.dialog.prototype.options.position;
+               if (position) {
+                       // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
+       //              if (typeof position == 'string' || $.isArray(position)) {
+       //                      myAt = $.isArray(position) ? position : position.split(' ');
 
-               // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
-//             if (typeof position == 'string' || $.isArray(position)) {
-//                     myAt = $.isArray(position) ? position : position.split(' ');
+                       if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
+                               myAt = position.split ? position.split(' ') : [position[0], position[1]];
+                               if (myAt.length === 1) {
+                                       myAt[1] = myAt[0];
+                               }
 
-               if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
-                       myAt = position.split ? position.split(' ') : [position[0], position[1]];
-                       if (myAt.length === 1) {
-                               myAt[1] = myAt[0];
-                       }
+                               $.each(['left', 'top'], function(i, offsetPosition) {
+                                       if (+myAt[i] === myAt[i]) {
+                                               offset[i] = myAt[i];
+                                               myAt[i] = offsetPosition;
+                                       }
+                               });
 
-                       $.each(['left', 'top'], function(i, offsetPosition) {
-                               if (+myAt[i] === myAt[i]) {
-                                       offset[i] = myAt[i];
-                                       myAt[i] = offsetPosition;
-                               }
-                       });
-               } else if (typeof position === 'object') {
-                       if ('left' in position) {
-                               myAt[0] = 'left';
-                               offset[0] = position.left;
-                       } else if ('right' in position) {
-                               myAt[0] = 'right';
-                               offset[0] = -position.right;
-                       }
+                               position = {
+                                       my: myAt.join(" "),
+                                       at: myAt.join(" "),
+                                       offset: offset.join(" ")
+                               };
+                       } 
 
-                       if ('top' in position) {
-                               myAt[1] = 'top';
-                               offset[1] = position.top;
-                       } else if ('bottom' in position) {
-                               myAt[1] = 'bottom';
-                               offset[1] = -position.bottom;
-                       }
+                       position = $.extend({}, $.ui.dialog.prototype.options.position, position);
+               } else {
+                       position = $.ui.dialog.prototype.options.position;
                }
 
                // need to show the dialog to get the actual offset in the position plugin
@@ -494,31 +527,40 @@ $.widget("ui.dialog", {
                this.uiDialog
                        // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
                        .css({ top: 0, left: 0 })
-                       .position({
-                               my: myAt.join(' '),
-                               at: myAt.join(' '),
-                               offset: offset.join(' '),
-                               of: window,
-                               collision: 'fit',
-                               // ensure that the titlebar is never outside the document
-                               using: function(pos) {
-                                       var topOffset = $(this).css(pos).offset().top;
-                                       if (topOffset < 0) {
-                                               $(this).css('top', pos.top - topOffset);
-                                       }
-                               }
-                       });
+                       .position($.extend({ of: window }, position));
                if (!isVisible) {
                        this.uiDialog.hide();
                }
        },
 
-       _setOption: function(key, value){
+       _setOptions: function( options ) {
                var self = this,
-                       uiDialog = self.uiDialog,
-                       isResizable = uiDialog.is(':data(resizable)'),
+                       resizableOptions = {},
                        resize = false;
-               
+
+               $.each( options, function( key, value ) {
+                       self._setOption( key, value );
+                       
+                       if ( key in sizeRelatedOptions ) {
+                               resize = true;
+                       }
+                       if ( key in resizableRelatedOptions ) {
+                               resizableOptions[ key ] = value;
+                       }
+               });
+
+               if ( resize ) {
+                       this._size();
+               }
+               if ( this.uiDialog.is( ":data(resizable)" ) ) {
+                       this.uiDialog.resizable( "option", resizableOptions );
+               }
+       },
+
+       _setOption: function(key, value){
+               var self = this,
+                       uiDialog = self.uiDialog;
+
                switch (key) {
                        //handling of deprecated beforeclose (vs beforeClose) option
                        //Ticket #4669 http://dev.jqueryui.com/ticket/4669
@@ -530,7 +572,7 @@ $.widget("ui.dialog", {
                                self._createButtons(value);
                                break;
                        case "closeText":
-                               // convert whatever was passed in to a string, for text() to not throw up
+                               // ensure that we always pass a string
                                self.uiDialogTitlebarCloseText.text("" + value);
                                break;
                        case "dialogClass":
@@ -546,44 +588,21 @@ $.widget("ui.dialog", {
                                }
                                break;
                        case "draggable":
-                               if (value) {
-                                       self._makeDraggable();
-                               } else {
-                                       uiDialog.draggable('destroy');
-                               }
-                               break;
-                       case "height":
-                               resize = true;
-                               break;
-                       case "maxHeight":
-                               if (isResizable) {
-                                       uiDialog.resizable('option', 'maxHeight', value);
-                               }
-                               resize = true;
-                               break;
-                       case "maxWidth":
-                               if (isResizable) {
-                                       uiDialog.resizable('option', 'maxWidth', value);
-                               }
-                               resize = true;
-                               break;
-                       case "minHeight":
-                               if (isResizable) {
-                                       uiDialog.resizable('option', 'minHeight', value);
+                               var isDraggable = uiDialog.is( ":data(draggable)" );
+                               if ( isDraggable && !value ) {
+                                       uiDialog.draggable( "destroy" );
                                }
-                               resize = true;
-                               break;
-                       case "minWidth":
-                               if (isResizable) {
-                                       uiDialog.resizable('option', 'minWidth', value);
+                               
+                               if ( !isDraggable && value ) {
+                                       self._makeDraggable();
                                }
-                               resize = true;
                                break;
                        case "position":
                                self._position(value);
                                break;
                        case "resizable":
                                // currently resizable, becoming non-resizable
+                               var isResizable = uiDialog.is( ":data(resizable)" );
                                if (isResizable && !value) {
                                        uiDialog.resizable('destroy');
                                }
@@ -602,15 +621,9 @@ $.widget("ui.dialog", {
                                // convert whatever was passed in o a string, for html() to not throw up
                                $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
                                break;
-                       case "width":
-                               resize = true;
-                               break;
                }
 
                $.Widget.prototype._setOption.apply(self, arguments);
-               if (resize) {
-                       self._size();
-               }
        },
 
        _size: function() {
@@ -618,16 +631,21 @@ $.widget("ui.dialog", {
                 * divs will both have width and height set, so we need to reset them
                 */
                var options = this.options,
-                       nonContentHeight;
+                       nonContentHeight,
+                       minContentHeight,
+                       isVisible = this.uiDialog.is( ":visible" );
 
                // reset content sizing
-               // hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
-               this.element.css({
+               this.element.show().css({
                        width: 'auto',
                        minHeight: 0,
                        height: 0
                });
 
+               if (options.minWidth > options.width) {
+                       options.width = options.minWidth;
+               }
+
                // reset wrapper sizing
                // determine the height of all the non-content elements
                nonContentHeight = this.uiDialog.css({
@@ -635,16 +653,26 @@ $.widget("ui.dialog", {
                                width: options.width
                        })
                        .height();
-
-               this.element
-                       .css(options.height === 'auto' ? {
-                                       minHeight: Math.max(options.minHeight - nonContentHeight, 0),
-                                       height: 'auto'
-                               } : {
-                                       minHeight: 0,
-                                       height: Math.max(options.height - nonContentHeight, 0)                          
-                       })
-                       .show();
+               minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
+               
+               if ( options.height === "auto" ) {
+                       // only needed for IE6 support
+                       if ( $.support.minHeight ) {
+                               this.element.css({
+                                       minHeight: minContentHeight,
+                                       height: "auto"
+                               });
+                       } else {
+                               this.uiDialog.show();
+                               var autoHeight = this.element.css( "height", "auto" ).height();
+                               if ( !isVisible ) {
+                                       this.uiDialog.hide();
+                               }
+                               this.element.height( Math.max( autoHeight, minContentHeight ) );
+                       }
+               } else {
+                       this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
+               }
 
                if (this.uiDialog.is(':data(resizable)')) {
                        this.uiDialog.resizable('option', 'minHeight', this._minHeight());
@@ -653,7 +681,7 @@ $.widget("ui.dialog", {
 });
 
 $.extend($.ui.dialog, {
-       version: "1.8.2",
+       version: "1.8.11",
 
        uuid: 0,
        maxZ: 0,
@@ -689,7 +717,10 @@ $.extend($.ui.dialog.overlay, {
                                if ($.ui.dialog.overlay.instances.length) {
                                        $(document).bind($.ui.dialog.overlay.events, function(event) {
                                                // stop events if the z-index of the target is < the z-index of the overlay
-                                               return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ);
+                                               // we cannot return true when we don't want to cancel the event (#3523)
+                                               if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
+                                                       return false;
+                                               }
                                        });
                                }
                        }, 1);
@@ -724,7 +755,10 @@ $.extend($.ui.dialog.overlay, {
        },
 
        destroy: function($el) {
-               this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
+               var indexOf = $.inArray($el, this.instances);
+               if (indexOf != -1){
+                       this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
+               }
 
                if (this.instances.length === 0) {
                        $([document, window]).unbind('.dialog-overlay');
index b4c1070..5f36761 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Draggable 1.8.2
+ * jQuery UI Draggable 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Draggables
  *
@@ -12,7 +12,7 @@
  *     jquery.ui.mouse.js
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
 $.widget("ui.draggable", $.ui.mouse, {
        widgetEventPrefix: "drag",
@@ -192,8 +192,8 @@ $.widget("ui.draggable", $.ui.mouse, {
                        this.dropped = false;
                }
                
-               //if the original element is removed, don't bother to continue
-               if(!this.element[0] || !this.element[0].parentNode)
+               //if the original element is removed, don't bother to continue if helper is set to "original"
+               if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
                        return false;
 
                if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
@@ -317,7 +317,9 @@ $.widget("ui.draggable", $.ui.mouse, {
        _cacheMargins: function() {
                this.margins = {
                        left: (parseInt(this.element.css("marginLeft"),10) || 0),
-                       top: (parseInt(this.element.css("marginTop"),10) || 0)
+                       top: (parseInt(this.element.css("marginTop"),10) || 0),
+                       right: (parseInt(this.element.css("marginRight"),10) || 0),
+                       bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
                };
        },
 
@@ -333,10 +335,10 @@ $.widget("ui.draggable", $.ui.mouse, {
                var o = this.options;
                if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
                if(o.containment == 'document' || o.containment == 'window') this.containment = [
-                       0 - this.offset.relative.left - this.offset.parent.left,
-                       0 - this.offset.relative.top - this.offset.parent.top,
-                       $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
-                       ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+                       (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left,
+                       (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top,
+                       (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+                       (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
                ];
 
                if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
@@ -345,10 +347,10 @@ $.widget("ui.draggable", $.ui.mouse, {
                        var over = ($(ce).css("overflow") != 'hidden');
 
                        this.containment = [
-                               co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
-                               co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
-                               co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
-                               co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+                               co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
+                               co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
+                               co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
+                               co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top  - this.margins.bottom
                        ];
                } else if(o.containment.constructor == Array) {
                        this.containment = o.containment;
@@ -459,7 +461,7 @@ $.widget("ui.draggable", $.ui.mouse, {
 });
 
 $.extend($.ui.draggable, {
-       version: "1.8.2"
+       version: "1.8.11"
 });
 
 $.ui.plugin.add("draggable", "connectToSortable", {
@@ -475,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);
                        }
                });
index b6a15fd..7d6b897 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Droppable 1.8.2
+ * jQuery UI Droppable 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Droppables
  *
@@ -13,7 +13,7 @@
  *     jquery.ui.mouse.js
  *     jquery.ui.draggable.js
  */
-(function($) {
+(function( $, undefined ) {
 
 $.widget("ui.droppable", {
        widgetEventPrefix: "drop",
@@ -147,7 +147,7 @@ $.widget("ui.droppable", {
 });
 
 $.extend($.ui.droppable, {
-       version: "1.8.2"
+       version: "1.8.11"
 });
 
 $.ui.intersect = function(draggable, droppable, toleranceMode) {
@@ -161,8 +161,8 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) {
 
        switch (toleranceMode) {
                case 'fit':
-                       return (l < x1 && x2 < r
-                               && t < y1 && y2 < b);
+                       return (l <= x1 && x2 <= r
+                               && t <= y1 && y2 <= b);
                        break;
                case 'intersect':
                        return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
@@ -212,11 +212,11 @@ $.ui.ddmanager = {
                        for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
                        m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue;                                                                       //If the element is not visible, continue
 
+                       if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
+
                        m[i].offset = m[i].element.offset();
                        m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
 
-                       if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
-
                }
 
        },
index 871edd8..b8db85c 100644 (file)
@@ -1,16 +1,16 @@
 /*!
- * jQuery UI Mouse 1.8.2
+ * jQuery UI Mouse 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Mouse
  *
  * Depends:
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
 $.widget("ui.mouse", {
        options: {
@@ -26,8 +26,8 @@ $.widget("ui.mouse", {
                                return self._mouseDown(event);
                        })
                        .bind('click.'+this.widgetName, function(event) {
-                               if(self._preventClickEvent) {
-                                       self._preventClickEvent = false;
+                               if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
+                                   $.removeData(event.target, self.widgetName + '.preventClickEvent');
                                        event.stopImmediatePropagation();
                                        return false;
                                }
@@ -75,6 +75,11 @@ $.widget("ui.mouse", {
                        }
                }
 
+               // Click event may never have fired (Gecko & Opera)
+               if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
+                       $.removeData(event.target, this.widgetName + '.preventClickEvent');
+               }
+
                // these delegates are required to keep context
                this._mouseMoveDelegate = function(event) {
                        return self._mouseMove(event);
@@ -86,18 +91,14 @@ $.widget("ui.mouse", {
                        .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
                        .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
 
-               // preventDefault() is used to prevent the selection of text here -
-               // however, in Safari, this causes select boxes not to be selectable
-               // anymore, so this fix is needed
-               ($.browser.safari || event.preventDefault());
-
+               event.preventDefault();
                event.originalEvent.mouseHandled = true;
                return true;
        },
 
        _mouseMove: function(event) {
                // IE mouseup check - mouseup happened when mouse was out of window
-               if ($.browser.msie && !event.button) {
+               if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
                        return this._mouseUp(event);
                }
 
@@ -122,7 +123,11 @@ $.widget("ui.mouse", {
 
                if (this._mouseStarted) {
                        this._mouseStarted = false;
-                       this._preventClickEvent = (event.target == this._mouseDownEvent.target);
+
+                       if (event.target == this._mouseDownEvent.target) {
+                           $.data(event.target, this.widgetName + '.preventClickEvent', true);
+                       }
+
                        this._mouseStop(event);
                }
 
index 50dd57f..b66e59e 100644 (file)
@@ -1,20 +1,19 @@
 /*
- * jQuery UI Position 1.8.2
+ * jQuery UI Position 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Position
  */
-(function( $ ) {
+(function( $, undefined ) {
 
 $.ui = $.ui || {};
 
 var horizontalPositions = /left|center|right/,
-       horizontalDefault = "center",
        verticalPositions = /top|center|bottom/,
-       verticalDefault = "center",
+       center = "center",
        _position = $.fn.position,
        _offset = $.fn.offset;
 
@@ -27,21 +26,23 @@ $.fn.position = function( options ) {
        options = $.extend( {}, options );
 
        var target = $( options.of ),
+               targetElem = target[0],
                collision = ( options.collision || "flip" ).split( " " ),
                offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
                targetWidth,
                targetHeight,
                basePosition;
 
-       if ( options.of.nodeType === 9 ) {
+       if ( targetElem.nodeType === 9 ) {
                targetWidth = target.width();
                targetHeight = target.height();
                basePosition = { top: 0, left: 0 };
-       } else if ( options.of.scrollTo && options.of.document ) {
+       // TODO: use $.isWindow() in 1.9
+       } else if ( targetElem.setTimeout ) {
                targetWidth = target.width();
                targetHeight = target.height();
                basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
-       } else if ( options.of.preventDefault ) {
+       } else if ( targetElem.preventDefault ) {
                // force left top to allow flipping
                options.at = "left top";
                targetWidth = targetHeight = 0;
@@ -58,13 +59,13 @@ $.fn.position = function( options ) {
                var pos = ( options[this] || "" ).split( " " );
                if ( pos.length === 1) {
                        pos = horizontalPositions.test( pos[0] ) ?
-                               pos.concat( [verticalDefault] ) :
+                               pos.concat( [center] ) :
                                verticalPositions.test( pos[0] ) ?
-                                       [ horizontalDefault ].concat( pos ) :
-                                       [ horizontalDefault, verticalDefault ];
+                                       [ center ].concat( pos ) :
+                                       [ center, center ];
                }
-               pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
-               pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
+               pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
+               pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
                options[ this ] = pos;
        });
 
@@ -82,13 +83,13 @@ $.fn.position = function( options ) {
 
        if ( options.at[0] === "right" ) {
                basePosition.left += targetWidth;
-       } else if (options.at[0] === horizontalDefault ) {
+       } else if ( options.at[0] === center ) {
                basePosition.left += targetWidth / 2;
        }
 
        if ( options.at[1] === "bottom" ) {
                basePosition.top += targetHeight;
-       } else if ( options.at[1] === verticalDefault ) {
+       } else if ( options.at[1] === center ) {
                basePosition.top += targetHeight / 2;
        }
 
@@ -99,23 +100,35 @@ $.fn.position = function( options ) {
                var elem = $( this ),
                        elemWidth = elem.outerWidth(),
                        elemHeight = elem.outerHeight(),
-                       position = $.extend( {}, basePosition );
+                       marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
+                       marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
+                       collisionWidth = elemWidth + marginLeft +
+                               ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
+                       collisionHeight = elemHeight + marginTop +
+                               ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
+                       position = $.extend( {}, basePosition ),
+                       collisionPosition;
 
                if ( options.my[0] === "right" ) {
                        position.left -= elemWidth;
-               } else if ( options.my[0] === horizontalDefault ) {
+               } else if ( options.my[0] === center ) {
                        position.left -= elemWidth / 2;
                }
 
                if ( options.my[1] === "bottom" ) {
                        position.top -= elemHeight;
-               } else if ( options.my[1] === verticalDefault ) {
+               } else if ( options.my[1] === center ) {
                        position.top -= elemHeight / 2;
                }
 
                // prevent fractions (see #5280)
-               position.left = parseInt( position.left );
-               position.top = parseInt( position.top );
+               position.left = Math.round( position.left );
+               position.top = Math.round( position.top );
+
+               collisionPosition = {
+                       left: position.left - marginLeft,
+                       top: position.top - marginTop
+               };
 
                $.each( [ "left", "top" ], function( i, dir ) {
                        if ( $.ui.position[ collision[i] ] ) {
@@ -124,6 +137,9 @@ $.fn.position = function( options ) {
                                        targetHeight: targetHeight,
                                        elemWidth: elemWidth,
                                        elemHeight: elemHeight,
+                                       collisionPosition: collisionPosition,
+                                       collisionWidth: collisionWidth,
+                                       collisionHeight: collisionHeight,
                                        offset: offset,
                                        my: options.my,
                                        at: options.at
@@ -142,41 +158,44 @@ $.ui.position = {
        fit: {
                left: function( position, data ) {
                        var win = $( window ),
-                               over = position.left + data.elemWidth - win.width() - win.scrollLeft();
-                       position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
+                               over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
+                       position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
                },
                top: function( position, data ) {
                        var win = $( window ),
-                               over = position.top + data.elemHeight - win.height() - win.scrollTop();
-                       position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
+                               over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
+                       position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
                }
        },
 
        flip: {
                left: function( position, data ) {
-                       if ( data.at[0] === "center" ) {
+                       if ( data.at[0] === center ) {
                                return;
                        }
                        var win = $( window ),
-                               over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
+                               over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
                                myOffset = data.my[ 0 ] === "left" ?
                                        -data.elemWidth :
                                        data.my[ 0 ] === "right" ?
                                                data.elemWidth :
                                                0,
+                               atOffset = data.at[ 0 ] === "left" ?
+                                       data.targetWidth :
+                                       -data.targetWidth,
                                offset = -2 * data.offset[ 0 ];
-                       position.left += position.left < 0 ?
-                               myOffset + data.targetWidth + offset :
+                       position.left += data.collisionPosition.left < 0 ?
+                               myOffset + atOffset + offset :
                                over > 0 ?
-                                       myOffset - data.targetWidth + offset :
+                                       myOffset + atOffset + offset :
                                        0;
                },
                top: function( position, data ) {
-                       if ( data.at[1] === "center" ) {
+                       if ( data.at[1] === center ) {
                                return;
                        }
                        var win = $( window ),
-                               over = position.top + data.elemHeight - win.height() - win.scrollTop(),
+                               over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
                                myOffset = data.my[ 1 ] === "top" ?
                                        -data.elemHeight :
                                        data.my[ 1 ] === "bottom" ?
@@ -186,8 +205,8 @@ $.ui.position = {
                                        data.targetHeight :
                                        -data.targetHeight,
                                offset = -2 * data.offset[ 1 ];
-                       position.top += position.top < 0 ?
-                               myOffset + data.targetHeight + offset :
+                       position.top += data.collisionPosition.top < 0 ?
+                               myOffset + atOffset + offset :
                                over > 0 ?
                                        myOffset + atOffset + offset :
                                        0;
index 4bc092d..c432132 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Progressbar 1.8.2
+ * jQuery UI Progressbar 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Progressbar
  *
  *   jquery.ui.core.js
  *   jquery.ui.widget.js
  */
-(function( $ ) {
+(function( $, undefined ) {
 
 $.widget( "ui.progressbar", {
        options: {
-               value: 0
+               value: 0,
+               max: 100
        },
+
+       min: 0,
+
        _create: function() {
                this.element
                        .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
                        .attr({
                                role: "progressbar",
-                               "aria-valuemin": this._valueMin(),
-                               "aria-valuemax": this._valueMax(),
+                               "aria-valuemin": this.min,
+                               "aria-valuemax": this.options.max,
                                "aria-valuenow": this._value()
                        });
 
                this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
                        .appendTo( this.element );
 
+               this.oldValue = this._value();
                this._refreshValue();
        },
 
@@ -56,12 +61,12 @@ $.widget( "ui.progressbar", {
        },
 
        _setOption: function( key, value ) {
-               switch ( key ) {
-                       case "value":
-                               this.options.value = value;
-                               this._refreshValue();
-                               this._trigger( "change" );
-                               break;
+               if ( key === "value" ) {
+                       this.options.value = value;
+                       this._refreshValue();
+                       if ( this._value() === this.options.max ) {
+                               this._trigger( "complete" );
+                       }
                }
 
                $.Widget.prototype._setOption.apply( this, arguments );
@@ -73,35 +78,31 @@ $.widget( "ui.progressbar", {
                if ( typeof val !== "number" ) {
                        val = 0;
                }
-               if ( val < this._valueMin() ) {
-                       val = this._valueMin();
-               }
-               if ( val > this._valueMax() ) {
-                       val = this._valueMax();
-               }
-
-               return val;
+               return Math.min( this.options.max, Math.max( this.min, val ) );
        },
 
-       _valueMin: function() {
-               return 0;
-       },
-
-       _valueMax: function() {
-               return 100;
+       _percentage: function() {
+               return 100 * this._value() / this.options.max;
        },
 
        _refreshValue: function() {
                var value = this.value();
+               var percentage = this._percentage();
+
+               if ( this.oldValue !== value ) {
+                       this.oldValue = value;
+                       this._trigger( "change" );
+               }
+
                this.valueDiv
-                       [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
-                       .width( value + "%" );
+                       .toggleClass( "ui-corner-right", value === this.options.max )
+                       .width( percentage.toFixed(0) + "%" );
                this.element.attr( "aria-valuenow", value );
        }
 });
 
 $.extend( $.ui.progressbar, {
-       version: "1.8.2"
+       version: "1.8.11"
 });
 
 })( jQuery );
index 0a782bb..1d1c906 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Resizable 1.8.2
+ * jQuery UI Resizable 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Resizables
  *
@@ -12,7 +12,7 @@
  *     jquery.ui.mouse.js
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
 $.widget("ui.resizable", $.ui.mouse, {
        widgetEventPrefix: "resize",
@@ -322,10 +322,10 @@ $.widget("ui.resizable", $.ui.mouse, {
 
                if(this._helper) {
                        var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
-                                               soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
-                                                       soffsetw = ista ? 0 : self.sizeDiff.width;
+                               soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+                               soffsetw = ista ? 0 : self.sizeDiff.width;
 
-                       var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
+                       var s = { width: (self.helper.width()  - soffsetw), height: (self.helper.height() - soffseth) },
                                left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
                                top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
 
@@ -519,7 +519,7 @@ $.widget("ui.resizable", $.ui.mouse, {
 });
 
 $.extend($.ui.resizable, {
-       version: "1.8.2"
+       version: "1.8.11"
 });
 
 /*
@@ -528,28 +528,29 @@ $.extend($.ui.resizable, {
 
 $.ui.plugin.add("resizable", "alsoResize", {
 
-       start: function(event, ui) {
-
+       start: function (event, ui) {
                var self = $(this).data("resizable"), o = self.options;
 
-               var _store = function(exp) {
+               var _store = function (exp) {
                        $(exp).each(function() {
-                               $(this).data("resizable-alsoresize", {
-                                       width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
-                                       left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
+                               var el = $(this);
+                               el.data("resizable-alsoresize", {
+                                       width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+                                       left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
+                                       position: el.css('position') // to reset Opera on stop()
                                });
                        });
                };
 
                if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
-                       if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0];      _store(o.alsoResize); }
-                       else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
+                       if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
+                       else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
                }else{
                        _store(o.alsoResize);
                }
        },
 
-       resize: function(event, ui){
+       resize: function (event, ui) {
                var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
 
                var delta = {
@@ -557,18 +558,19 @@ $.ui.plugin.add("resizable", "alsoResize", {
                        top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
                },
 
-               _alsoResize = function(exp, c) {
+               _alsoResize = function (exp, c) {
                        $(exp).each(function() {
-                               var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
+                               var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, 
+                                       css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
 
-                               $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
+                               $.each(css, function (i, prop) {
                                        var sum = (start[prop]||0) + (delta[prop]||0);
                                        if (sum && sum >= 0)
                                                style[prop] = sum || null;
                                });
 
-                               //Opera fixing relative position
-                               if (/relative/.test(el.css('position')) && $.browser.opera) {
+                               // Opera fixing relative position
+                               if ($.browser.opera && /relative/.test(el.css('position'))) {
                                        self._revertToRelativePosition = true;
                                        el.css({ position: 'absolute', top: 'auto', left: 'auto' });
                                }
@@ -578,22 +580,33 @@ $.ui.plugin.add("resizable", "alsoResize", {
                };
 
                if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
-                       $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
+                       $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
                }else{
                        _alsoResize(o.alsoResize);
                }
        },
 
-       stop: function(event, ui){
-               var self = $(this).data("resizable");
+       stop: function (event, ui) {
+               var self = $(this).data("resizable"), o = self.options;
 
-               //Opera fixing relative position
-               if (self._revertToRelativePosition && $.browser.opera) {
+               var _reset = function (exp) {
+                       $(exp).each(function() {
+                               var el = $(this);
+                               // reset position for Opera - no need to verify it was changed
+                               el.css({ position: el.data("resizable-alsoresize").position });
+                       });
+               };
+
+               if (self._revertToRelativePosition) {
                        self._revertToRelativePosition = false;
-                       el.css({ position: 'relative' });
+                       if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
+                               $.each(o.alsoResize, function (exp) { _reset(exp); });
+                       }else{
+                               _reset(o.alsoResize);
+                       }
                }
 
-               $(this).removeData("resizable-alsoresize-start");
+               $(this).removeData("resizable-alsoresize");
        }
 });
 
index bc707d3..e3b9132 100644 (file)
@@ -1,10 +1,9 @@
-
 /*
- * jQuery UI Selectable 1.8.2
+ * jQuery UI Selectable 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Selectables
  *
@@ -13,7 +12,7 @@
  *     jquery.ui.mouse.js
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
 $.widget("ui.selectable", $.ui.mouse, {
        options: {
@@ -90,8 +89,6 @@ $.widget("ui.selectable", $.ui.mouse, {
                $(options.appendTo).append(this.helper);
                // position helper (lasso)
                this.helper.css({
-                       "z-index": 100,
-                       "position": "absolute",
                        "left": event.clientX,
                        "top": event.clientY,
                        "width": 0,
@@ -263,7 +260,7 @@ $.widget("ui.selectable", $.ui.mouse, {
 });
 
 $.extend($.ui.selectable, {
-       version: "1.8.2"
+       version: "1.8.11"
 });
 
 })(jQuery);
index 81d854b..f02a922 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Slider 1.8.2
+ * jQuery UI Slider 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Slider
  *
@@ -12,8 +12,7 @@
  *     jquery.ui.mouse.js
  *     jquery.ui.widget.js
  */
-
-(function( $ ) {
+(function( $, undefined ) {
 
 // number of pages in a slider
 // (how many times can you page up/down to go through the whole range)
@@ -310,8 +309,9 @@ $.widget( "ui.slider", $.ui.mouse, {
                                ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
                };
 
-               normValue = this._normValueFromMouse( position );
-               this._slide( event, index, normValue );
+               if ( !this.handles.hasClass( "ui-state-hover" ) ) {
+                       this._slide( event, index, normValue );
+               }
                this._animateOff = true;
                return true;
        },
@@ -585,14 +585,14 @@ $.widget( "ui.slider", $.ui.mouse, {
        
        // returns the step-aligned value that val is closest to, between (inclusive) min and max
        _trimAlignValue: function( val ) {
-               if ( val < this._valueMin() ) {
+               if ( val <= this._valueMin() ) {
                        return this._valueMin();
                }
-               if ( val > this._valueMax() ) {
+               if ( val >= this._valueMax() ) {
                        return this._valueMax();
                }
                var step = ( this.options.step > 0 ) ? this.options.step : 1,
-                       valModStep = val % step,
+                       valModStep = (val - this._valueMin()) % step;
                        alignValue = val - valModStep;
 
                if ( Math.abs(valModStep) * 2 >= step ) {
@@ -676,7 +676,7 @@ $.widget( "ui.slider", $.ui.mouse, {
 });
 
 $.extend( $.ui.slider, {
-       version: "1.8.2"
+       version: "1.8.11"
 });
 
 }(jQuery));
index fe9898e..1a06dca 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Sortable 1.8.2
+ * jQuery UI Sortable 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Sortables
  *
@@ -12,7 +12,7 @@
  *     jquery.ui.mouse.js
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
 $.widget("ui.sortable", $.ui.mouse, {
        widgetEventPrefix: "sort",
@@ -49,8 +49,8 @@ $.widget("ui.sortable", $.ui.mouse, {
                //Get the items
                this.refresh();
 
-               //Let's determine if the items are floating
-               this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
+               //Let's determine if the items are being displayed horizontally
+               this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
 
                //Let's determine the parent's offset
                this.offset = this.element.offset();
@@ -360,7 +360,7 @@ $.widget("ui.sortable", $.ui.mouse, {
 
                if(this.dragging) {
 
-                       this._mouseUp();
+                       this._mouseUp({ target: null });
 
                        if(this.options.helper == "original")
                                this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
@@ -378,21 +378,23 @@ $.widget("ui.sortable", $.ui.mouse, {
 
                }
 
-               //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
-               if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
-               if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
-
-               $.extend(this, {
-                       helper: null,
-                       dragging: false,
-                       reverting: false,
-                       _noFinalSort: null
-               });
+               if (this.placeholder) {
+                       //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+                       if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+                       if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
 
-               if(this.domPosition.prev) {
-                       $(this.domPosition.prev).after(this.currentItem);
-               } else {
-                       $(this.domPosition.parent).prepend(this.currentItem);
+                       $.extend(this, {
+                               helper: null,
+                               dragging: false,
+                               reverting: false,
+                               _noFinalSort: null
+                       });
+
+                       if(this.domPosition.prev) {
+                               $(this.domPosition.prev).after(this.currentItem);
+                       } else {
+                               $(this.domPosition.parent).prepend(this.currentItem);
+                       }
                }
 
                return this;
@@ -409,6 +411,10 @@ $.widget("ui.sortable", $.ui.mouse, {
                        if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
                });
 
+               if(!str.length && o.key) {
+                       str.push(o.key + '=');
+               }
+
                return str.join('&');
 
        },
@@ -1061,7 +1067,7 @@ $.widget("ui.sortable", $.ui.mouse, {
 });
 
 $.extend($.ui.sortable, {
-       version: "1.8.2"
+       version: "1.8.11"
 });
 
 })(jQuery);
index 1f94d52..3be7ff4 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * jQuery UI Tabs 1.8.2
+ * jQuery UI Tabs 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Tabs
  *
@@ -11,7 +11,7 @@
  *     jquery.ui.core.js
  *     jquery.ui.widget.js
  */
-(function($) {
+(function( $, undefined ) {
 
 var tabId = 0,
        listId = 0;
@@ -24,7 +24,7 @@ function getNextListId() {
        return ++listId;
 }
 
-$.widget("ui.tabs", {
+$.widget( "ui.tabs", {
        options: {
                add: null,
                ajaxOptions: null,
@@ -34,619 +34,650 @@ $.widget("ui.tabs", {
                disable: null,
                disabled: [],
                enable: null,
-               event: 'click',
+               event: "click",
                fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
-               idPrefix: 'ui-tabs-',
+               idPrefix: "ui-tabs-",
                load: null,
-               panelTemplate: '<div></div>',
+               panelTemplate: "<div></div>",
                remove: null,
                select: null,
                show: null,
-               spinner: '<em>Loading&#8230;</em>',
-               tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
+               spinner: "<em>Loading&#8230;</em>",
+               tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
        },
+
        _create: function() {
-               this._tabify(true);
+               this._tabify( true );
        },
 
-       _setOption: function(key, value) {
-               if (key == 'selected') {
-                       if (this.options.collapsible && value == this.options.selected) {
+       _setOption: function( key, value ) {
+               if ( key == "selected" ) {
+                       if (this.options.collapsible && value == this.options.selected ) {
                                return;
                        }
-                       this.select(value);
-               }
-               else {
-                       this.options[key] = value;
+                       this.select( value );
+               } else {
+                       this.options[ key ] = value;
                        this._tabify();
                }
        },
 
-       _tabId: function(a) {
-               return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
+       _tabId: function( a ) {
+               return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
                        this.options.idPrefix + getNextTabId();
        },
 
-       _sanitizeSelector: function(hash) {
-               return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
+       _sanitizeSelector: function( hash ) {
+               // we need this because an id may contain a ":"
+               return hash.replace( /:/g, "\\:" );
        },
 
        _cookie: function() {
-               var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + getNextListId());
-               return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
+               var cookie = this.cookie ||
+                       ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
+               return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
        },
 
-       _ui: function(tab, panel) {
+       _ui: function( tab, panel ) {
                return {
                        tab: tab,
                        panel: panel,
-                       index: this.anchors.index(tab)
+                       index: this.anchors.index( tab )
                };
        },
 
        _cleanup: function() {
                // restore all former loading tabs labels
-               this.lis.filter('.ui-state-processing').removeClass('ui-state-processing')
-                               .find('span:data(label.tabs)')
+               this.lis.filter( ".ui-state-processing" )
+                       .removeClass( "ui-state-processing" )
+                       .find( "span:data(label.tabs)" )
                                .each(function() {
-                                       var el = $(this);
-                                       el.html(el.data('label.tabs')).removeData('label.tabs');
+                                       var el = $( this );
+                                       el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
                                });
        },
 
-       _tabify: function(init) {
-
-               this.list = this.element.find('ol,ul').eq(0);
-               this.lis = $('li:has(a[href])', this.list);
-               this.anchors = this.lis.map(function() { return $('a', this)[0]; });
-               this.panels = $([]);
+       _tabify: function( init ) {
+               var self = this,
+                       o = this.options,
+                       fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
 
-               var self = this, o = this.options;
-
-               var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
-               this.anchors.each(function(i, a) {
-                       var href = $(a).attr('href');
+               this.list = this.element.find( "ol,ul" ).eq( 0 );
+               this.lis = $( " > li:has(a[href])", this.list );
+               this.anchors = this.lis.map(function() {
+                       return $( "a", this )[ 0 ];
+               });
+               this.panels = $( [] );
 
+               this.anchors.each(function( i, a ) {
+                       var href = $( a ).attr( "href" );
                        // For dynamically created HTML that contains a hash as href IE < 8 expands
                        // such href to the full page url with hash and then misinterprets tab as ajax.
                        // Same consideration applies for an added tab with a fragment identifier
                        // since a[href=#fragment-identifier] does unexpectedly not match.
                        // Thus normalize href attribute...
-                       var hrefBase = href.split('#')[0], baseEl;
-                       if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
-                                       (baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
+                       var hrefBase = href.split( "#" )[ 0 ],
+                               baseEl;
+                       if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
+                                       ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
                                href = a.hash;
                                a.href = href;
                        }
 
                        // inline tab
-                       if (fragmentId.test(href)) {
-                               self.panels = self.panels.add(self._sanitizeSelector(href));
-                       }
-
+                       if ( fragmentId.test( href ) ) {
+                               self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
                        // remote tab
-                       else if (href != '#') { // prevent loading the page itself if href is just "#"
-                               $.data(a, 'href.tabs', href); // required for restore on destroy
+                       // prevent loading the page itself if href is just "#"
+                       } else if ( href && href !== "#" ) {
+                               // required for restore on destroy
+                               $.data( a, "href.tabs", href );
 
                                // TODO until #3808 is fixed strip fragment identifier from url
                                // (IE fails to load from such url)
-                               $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data
-
-                               var id = self._tabId(a);
-                               a.href = '#' + id;
-                               var $panel = $('#' + id);
-                               if (!$panel.length) {
-                                       $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom')
-                                               .insertAfter(self.panels[i - 1] || self.list);
-                                       $panel.data('destroy.tabs', true);
+                               $.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
+
+                               var id = self._tabId( a );
+                               a.href = "#" + id;
+                               var $panel = self.element.find( "#" + id );
+                               if ( !$panel.length ) {
+                                       $panel = $( o.panelTemplate )
+                                               .attr( "id", id )
+                                               .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+                                               .insertAfter( self.panels[ i - 1 ] || self.list );
+                                       $panel.data( "destroy.tabs", true );
                                }
-                               self.panels = self.panels.add($panel);
-                       }
-
+                               self.panels = self.panels.add( $panel );
                        // invalid tab href
-                       else {
-                               o.disabled.push(i);
+                       else {
+                               o.disabled.push( i );
                        }
                });
 
                // initialization from scratch
-               if (init) {
-
+               if ( init ) {
                        // attach necessary classes for styling
-                       this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
-                       this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
-                       this.lis.addClass('ui-state-default ui-corner-top');
-                       this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');
+                       this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
+                       this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
+                       this.lis.addClass( "ui-state-default ui-corner-top" );
+                       this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
 
                        // Selected tab
                        // use "selected" option or try to retrieve:
                        // 1. from fragment identifier in url
                        // 2. from cookie
                        // 3. from selected class attribute on <li>
-                       if (o.selected === undefined) {
-                               if (location.hash) {
-                                       this.anchors.each(function(i, a) {
-                                               if (a.hash == location.hash) {
+                       if ( o.selected === undefined ) {
+                               if ( location.hash ) {
+                                       this.anchors.each(function( i, a ) {
+                                               if ( a.hash == location.hash ) {
                                                        o.selected = i;
-                                                       return false; // break
+                                                       return false;
                                                }
                                        });
                                }
-                               if (typeof o.selected != 'number' && o.cookie) {
-                                       o.selected = parseInt(self._cookie(), 10);
+                               if ( typeof o.selected !== "number" && o.cookie ) {
+                                       o.selected = parseInt( self._cookie(), 10 );
                                }
-                               if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) {
-                                       o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
+                               if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
+                                       o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
                                }
-                               o.selected = o.selected || (this.lis.length ? 0 : -1);
-                       }
-                       else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release
+                               o.selected = o.selected || ( this.lis.length ? 0 : -1 );
+                       } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
                                o.selected = -1;
                        }
 
                        // sanity check - default to first tab...
-                       o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0;
+                       o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
+                               ? o.selected
+                               : 0;
 
                        // Take disabling tabs via class attribute from HTML
                        // into account and update option properly.
                        // A selected tab cannot become disabled.
-                       o.disabled = $.unique(o.disabled.concat(
-                               $.map(this.lis.filter('.ui-state-disabled'),
-                                       function(n, i) { return self.lis.index(n); } )
-                       )).sort();
-
-                       if ($.inArray(o.selected, o.disabled) != -1) {
-                               o.disabled.splice($.inArray(o.selected, o.disabled), 1);
+                       o.disabled = $.unique( o.disabled.concat(
+                               $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
+                                       return self.lis.index( n );
+                               })
+                       ) ).sort();
+
+                       if ( $.inArray( o.selected, o.disabled ) != -1 ) {
+                               o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
                        }
 
                        // highlight selected tab
-                       this.panels.addClass('ui-tabs-hide');
-                       this.lis.removeClass('ui-tabs-selected ui-state-active');
-                       if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list
-                               this.panels.eq(o.selected).removeClass('ui-tabs-hide');
-                               this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');
+                       this.panels.addClass( "ui-tabs-hide" );
+                       this.lis.removeClass( "ui-tabs-selected ui-state-active" );
+                       // check for length avoids error when initializing empty list
+                       if ( o.selected >= 0 && this.anchors.length ) {
+                               self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
+                               this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
 
                                // seems to be expected behavior that the show callback is fired
-                               self.element.queue("tabs", function() {
-                                       self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected]));
+                               self.element.queue( "tabs", function() {
+                                       self._trigger( "show", null,
+                                               self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );
                                });
-                               
-                               this.load(o.selected);
+
+                               this.load( o.selected );
                        }
 
                        // clean up to avoid memory leaks in certain versions of IE 6
-                       $(window).bind('unload', function() {
-                               self.lis.add(self.anchors).unbind('.tabs');
+                       // TODO: namespace this event
+                       $( window ).bind( "unload", function() {
+                               self.lis.add( self.anchors ).unbind( ".tabs" );
                                self.lis = self.anchors = self.panels = null;
                        });
-
-               }
                // update selected after add/remove
-               else {
-                       o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
+               else {
+                       o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
                }
 
                // update collapsible
-               this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible');
+               // TODO: use .toggleClass()
+               this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
 
                // set or update cookie after init and add/remove respectively
-               if (o.cookie) {
-                       this._cookie(o.selected, o.cookie);
+               if ( o.cookie ) {
+                       this._cookie( o.selected, o.cookie );
                }
 
                // disable tabs
-               for (var i = 0, li; (li = this.lis[i]); i++) {
-                       $(li)[$.inArray(i, o.disabled) != -1 &&
-                               !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');
+               for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
+                       $( li )[ $.inArray( i, o.disabled ) != -1 &&
+                               // TODO: use .toggleClass()
+                               !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
                }
 
                // reset cache if switching from cached to not cached
-               if (o.cache === false) {
-                       this.anchors.removeData('cache.tabs');
+               if ( o.cache === false ) {
+                       this.anchors.removeData( "cache.tabs" );
                }
 
                // remove all handlers before, tabify may run on existing tabs after add or option change
-               this.lis.add(this.anchors).unbind('.tabs');
+               this.lis.add( this.anchors ).unbind( ".tabs" );
 
-               if (o.event != 'mouseover') {
-                       var addState = function(state, el) {
-                               if (el.is(':not(.ui-state-disabled)')) {
-                                       el.addClass('ui-state-' + state);
+               if ( o.event !== "mouseover" ) {
+                       var addState = function( state, el ) {
+                               if ( el.is( ":not(.ui-state-disabled)" ) ) {
+                                       el.addClass( "ui-state-" + state );
                                }
                        };
-                       var removeState = function(state, el) {
-                               el.removeClass('ui-state-' + state);
+                       var removeState = function( state, el ) {
+                               el.removeClass( "ui-state-" + state );
                        };
-                       this.lis.bind('mouseover.tabs', function() {
-                               addState('hover', $(this));
+                       this.lis.bind( "mouseover.tabs" , function() {
+                               addState( "hover", $( this ) );
                        });
-                       this.lis.bind('mouseout.tabs', function() {
-                               removeState('hover', $(this));
+                       this.lis.bind( "mouseout.tabs", function() {
+                               removeState( "hover", $( this ) );
                        });
-                       this.anchors.bind('focus.tabs', function() {
-                               addState('focus', $(this).closest('li'));
+                       this.anchors.bind( "focus.tabs", function() {
+                               addState( "focus", $( this ).closest( "li" ) );
                        });
-                       this.anchors.bind('blur.tabs', function() {
-                               removeState('focus', $(this).closest('li'));
+                       this.anchors.bind( "blur.tabs", function() {
+                               removeState( "focus", $( this ).closest( "li" ) );
                        });
                }
 
                // set up animations
                var hideFx, showFx;
-               if (o.fx) {
-                       if ($.isArray(o.fx)) {
-                               hideFx = o.fx[0];
-                               showFx = o.fx[1];
-                       }
-                       else {
+               if ( o.fx ) {
+                       if ( $.isArray( o.fx ) ) {
+                               hideFx = o.fx[ 0 ];
+                               showFx = o.fx[ 1 ];
+                       } else {
                                hideFx = showFx = o.fx;
                        }
                }
 
                // Reset certain styles left over from animation
                // and prevent IE's ClearType bug...
-               function resetStyle($el, fx) {
-                       $el.css({ display: '' });
-                       if (!$.support.opacity && fx.opacity) {
-                               $el[0].style.removeAttribute('filter');
+               function resetStyle( $el, fx ) {
+                       $el.css( "display", "" );
+                       if ( !$.support.opacity && fx.opacity ) {
+                               $el[ 0 ].style.removeAttribute( "filter" );
                        }
                }
 
                // Show a tab...
-               var showTab = showFx ?
-                       function(clicked, $show) {
-                               $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
-                               $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way
-                                       .animate(showFx, showFx.duration || 'normal', function() {
-                                               resetStyle($show, showFx);
-                                               self._trigger('show', null, self._ui(clicked, $show[0]));
+               var showTab = showFx
+                       ? function( clicked, $show ) {
+                               $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
+                               $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
+                                       .animate( showFx, showFx.duration || "normal", function() {
+                                               resetStyle( $show, showFx );
+                                               self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
                                        });
-                       } :
-                       function(clicked, $show) {
-                               $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
-                               $show.removeClass('ui-tabs-hide');
-                               self._trigger('show', null, self._ui(clicked, $show[0]));
+                       }
+                       : function( clicked, $show ) {
+                               $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
+                               $show.removeClass( "ui-tabs-hide" );
+                               self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
                        };
 
                // Hide a tab, $show is optional...
-               var hideTab = hideFx ?
-                       function(clicked, $hide) {
-                               $hide.animate(hideFx, hideFx.duration || 'normal', function() {
-                                       self.lis.removeClass('ui-tabs-selected ui-state-active');
-                                       $hide.addClass('ui-tabs-hide');
-                                       resetStyle($hide, hideFx);
-                                       self.element.dequeue("tabs");
+               var hideTab = hideFx
+                       ? function( clicked, $hide ) {
+                               $hide.animate( hideFx, hideFx.duration || "normal", function() {
+                                       self.lis.removeClass( "ui-tabs-selected ui-state-active" );
+                                       $hide.addClass( "ui-tabs-hide" );
+                                       resetStyle( $hide, hideFx );
+                                       self.element.dequeue( "tabs" );
                                });
-                       } :
-                       function(clicked, $hide, $show) {
-                               self.lis.removeClass('ui-tabs-selected ui-state-active');
-                               $hide.addClass('ui-tabs-hide');
-                               self.element.dequeue("tabs");
+                       }
+                       : function( clicked, $hide, $show ) {
+                               self.lis.removeClass( "ui-tabs-selected ui-state-active" );
+                               $hide.addClass( "ui-tabs-hide" );
+                               self.element.dequeue( "tabs" );
                        };
 
                // attach tab event handler, unbind to avoid duplicates from former tabifying...
-               this.anchors.bind(o.event + '.tabs', function() {
-                       var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'),
-                                       $show = $(self._sanitizeSelector(this.hash));
+               this.anchors.bind( o.event + ".tabs", function() {
+                       var el = this,
+                               $li = $(el).closest( "li" ),
+                               $hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
+                               $show = self.element.find( self._sanitizeSelector( el.hash ) );
 
                        // If tab is already selected and not collapsible or tab disabled or
                        // or is already loading or click callback returns false stop here.
                        // Check if click handler returns false last so that it is not executed
                        // for a disabled or loading tab!
-                       if (($li.hasClass('ui-tabs-selected') && !o.collapsible) ||
-                               $li.hasClass('ui-state-disabled') ||
-                               $li.hasClass('ui-state-processing') ||
-                               self._trigger('select', null, self._ui(this, $show[0])) === false) {
+                       if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
+                               $li.hasClass( "ui-state-disabled" ) ||
+                               $li.hasClass( "ui-state-processing" ) ||
+                               self.panels.filter( ":animated" ).length ||
+                               self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
                                this.blur();
                                return false;
                        }
 
-                       o.selected = self.anchors.index(this);
+                       o.selected = self.anchors.index( this );
 
                        self.abort();
 
                        // if tab may be closed
-                       if (o.collapsible) {
-                               if ($li.hasClass('ui-tabs-selected')) {
+                       if ( o.collapsible ) {
+                               if ( $li.hasClass( "ui-tabs-selected" ) ) {
                                        o.selected = -1;
 
-                                       if (o.cookie) {
-                                               self._cookie(o.selected, o.cookie);
+                                       if ( o.cookie ) {
+                                               self._cookie( o.selected, o.cookie );
                                        }
 
-                                       self.element.queue("tabs", function() {
-                                               hideTab(el, $hide);
-                                       }).dequeue("tabs");
-                                       
+                                       self.element.queue( "tabs", function() {
+                                               hideTab( el, $hide );
+                                       }).dequeue( "tabs" );
+
                                        this.blur();
                                        return false;
-                               }
-                               else if (!$hide.length) {
-                                       if (o.cookie) {
-                                               self._cookie(o.selected, o.cookie);
+                               } else if ( !$hide.length ) {
+                                       if ( o.cookie ) {
+                                               self._cookie( o.selected, o.cookie );
                                        }
-                                       
-                                       self.element.queue("tabs", function() {
-                                               showTab(el, $show);
+
+                                       self.element.queue( "tabs", function() {
+                                               showTab( el, $show );
                                        });
 
-                                       self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
-                                       
+                                       // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
+                                       self.load( self.anchors.index( this ) );
+
                                        this.blur();
                                        return false;
                                }
                        }
 
-                       if (o.cookie) {
-                               self._cookie(o.selected, o.cookie);
+                       if ( o.cookie ) {
+                               self._cookie( o.selected, o.cookie );
                        }
 
                        // show new tab
-                       if ($show.length) {
-                               if ($hide.length) {
-                                       self.element.queue("tabs", function() {
-                                               hideTab(el, $hide);
+                       if ( $show.length ) {
+                               if ( $hide.length ) {
+                                       self.element.queue( "tabs", function() {
+                                               hideTab( el, $hide );
                                        });
                                }
-                               self.element.queue("tabs", function() {
-                                       showTab(el, $show);
+                               self.element.queue( "tabs", function() {
+                                       showTab( el, $show );
                                });
-                               
-                               self.load(self.anchors.index(this));
-                       }
-                       else {
-                               throw 'jQuery UI Tabs: Mismatching fragment identifier.';
+
+                               self.load( self.anchors.index( this ) );
+                       } else {
+                               throw "jQuery UI Tabs: Mismatching fragment identifier.";
                        }
 
                        // Prevent IE from keeping other link focussed when using the back button
                        // and remove dotted border from clicked link. This is controlled via CSS
                        // in modern browsers; blur() removes focus from address bar in Firefox
                        // which can become a usability and annoying problem with tabs('rotate').
-                       if ($.browser.msie) {
+                       if ( $.browser.msie ) {
                                this.blur();
                        }
-
                });
 
                // disable click in any case
-               this.anchors.bind('click.tabs', function(){return false;});
+               this.anchors.bind( "click.tabs", function(){
+                       return false;
+               });
+       },
+
+    _getIndex: function( index ) {
+               // meta-function to give users option to provide a href string instead of a numerical index.
+               // also sanitizes numerical indexes to valid values.
+               if ( typeof index == "string" ) {
+                       index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
+               }
 
+               return index;
        },
 
        destroy: function() {
                var o = this.options;
 
                this.abort();
-               
-               this.element.unbind('.tabs')
-                       .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
-                       .removeData('tabs');
 
-               this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
+               this.element
+                       .unbind( ".tabs" )
+                       .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
+                       .removeData( "tabs" );
+
+               this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
 
                this.anchors.each(function() {
-                       var href = $.data(this, 'href.tabs');
-                       if (href) {
+                       var href = $.data( this, "href.tabs" );
+                       if ( href ) {
                                this.href = href;
                        }
-                       var $this = $(this).unbind('.tabs');
-                       $.each(['href', 'load', 'cache'], function(i, prefix) {
-                               $this.removeData(prefix + '.tabs');
+                       var $this = $( this ).unbind( ".tabs" );
+                       $.each( [ "href", "load", "cache" ], function( i, prefix ) {
+                               $this.removeData( prefix + ".tabs" );
                        });
                });
 
-               this.lis.unbind('.tabs').add(this.panels).each(function() {
-                       if ($.data(this, 'destroy.tabs')) {
-                               $(this).remove();
-                       }
-                       else {
-                               $(this).removeClass([
-                                       'ui-state-default',
-                                       'ui-corner-top',
-                                       'ui-tabs-selected',
-                                       'ui-state-active',
-                                       'ui-state-hover',
-                                       'ui-state-focus',
-                                       'ui-state-disabled',
-                                       'ui-tabs-panel',
-                                       'ui-widget-content',
-                                       'ui-corner-bottom',
-                                       'ui-tabs-hide'
-                               ].join(' '));
+               this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
+                       if ( $.data( this, "destroy.tabs" ) ) {
+                               $( this ).remove();
+                       } else {
+                               $( this ).removeClass([
+                                       "ui-state-default",
+                                       "ui-corner-top",
+                                       "ui-tabs-selected",
+                                       "ui-state-active",
+                                       "ui-state-hover",
+                                       "ui-state-focus",
+                                       "ui-state-disabled",
+                                       "ui-tabs-panel",
+                                       "ui-widget-content",
+                                       "ui-corner-bottom",
+                                       "ui-tabs-hide"
+                               ].join( " " ) );
                        }
                });
 
-               if (o.cookie) {
-                       this._cookie(null, o.cookie);
+               if ( o.cookie ) {
+                       this._cookie( null, o.cookie );
                }
 
                return this;
        },
 
-       add: function(url, label, index) {
-               if (index === undefined) {
-                       index = this.anchors.length; // append by default
+       add: function( url, label, index ) {
+               if ( index === undefined ) {
+                       index = this.anchors.length;
                }
 
-               var self = this, o = this.options,
-                       $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)),
-                       id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]);
+               var self = this,
+                       o = this.options,
+                       $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
+                       id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
 
-               $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true);
+               $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
 
                // try to find an existing element before creating a new one
-               var $panel = $('#' + id);
-               if (!$panel.length) {
-                       $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true);
-               }
-               $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');
-
-               if (index >= this.lis.length) {
-                       $li.appendTo(this.list);
-                       $panel.appendTo(this.list[0].parentNode);
+               var $panel = self.element.find( "#" + id );
+               if ( !$panel.length ) {
+                       $panel = $( o.panelTemplate )
+                               .attr( "id", id )
+                               .data( "destroy.tabs", true );
                }
-               else {
-                       $li.insertBefore(this.lis[index]);
-                       $panel.insertBefore(this.panels[index]);
+               $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
+
+               if ( index >= this.lis.length ) {
+                       $li.appendTo( this.list );
+                       $panel.appendTo( this.list[ 0 ].parentNode );
+               } else {
+                       $li.insertBefore( this.lis[ index ] );
+                       $panel.insertBefore( this.panels[ index ] );
                }
 
-               o.disabled = $.map(o.disabled,
-                       function(n, i) { return n >= index ? ++n : n; });
+               o.disabled = $.map( o.disabled, function( n, i ) {
+                       return n >= index ? ++n : n;
+               });
 
                this._tabify();
 
-               if (this.anchors.length == 1) { // after tabify
+               if ( this.anchors.length == 1 ) {
                        o.selected = 0;
-                       $li.addClass('ui-tabs-selected ui-state-active');
-                       $panel.removeClass('ui-tabs-hide');
-                       this.element.queue("tabs", function() {
-                               self._trigger('show', null, self._ui(self.anchors[0], self.panels[0]));
+                       $li.addClass( "ui-tabs-selected ui-state-active" );
+                       $panel.removeClass( "ui-tabs-hide" );
+                       this.element.queue( "tabs", function() {
+                               self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
                        });
-                               
-                       this.load(0);
+
+                       this.load( 0 );
                }
 
-               // callback
-               this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
+               this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
                return this;
        },
 
-       remove: function(index) {
-               var o = this.options, $li = this.lis.eq(index).remove(),
-                       $panel = this.panels.eq(index).remove();
+       remove: function( index ) {
+               index = this._getIndex( index );
+               var o = this.options,
+                       $li = this.lis.eq( index ).remove(),
+                       $panel = this.panels.eq( index ).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 ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) {
-                       this.select(index + (index + 1 < this.anchors.length ? 1 : -1));
+               if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
+                       this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
                }
 
-               o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
-                       function(n, i) { return n >= index ? --n : n; });
+               o.disabled = $.map(
+                       $.grep( o.disabled, function(n, i) {
+                               return n != index;
+                       }),
+                       function( n, i ) {
+                               return n >= index ? --n : n;
+                       });
 
                this._tabify();
 
-               // callback
-               this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
+               this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
                return this;
        },
 
-       enable: function(index) {
+       enable: function( index ) {
+               index = this._getIndex( index );
                var o = this.options;
-               if ($.inArray(index, o.disabled) == -1) {
+               if ( $.inArray( index, o.disabled ) == -1 ) {
                        return;
                }
 
-               this.lis.eq(index).removeClass('ui-state-disabled');
-               o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
+               this.lis.eq( index ).removeClass( "ui-state-disabled" );
+               o.disabled = $.grep( o.disabled, function( n, i ) {
+                       return n != index;
+               });
 
-               // callback
-               this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
+               this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
                return this;
        },
 
-       disable: function(index) {
+       disable: function( index ) {
+               index = this._getIndex( index );
                var self = this, o = this.options;
-               if (index != o.selected) { // cannot disable already selected tab
-                       this.lis.eq(index).addClass('ui-state-disabled');
+               // cannot disable already selected tab
+               if ( index != o.selected ) {
+                       this.lis.eq( index ).addClass( "ui-state-disabled" );
 
-                       o.disabled.push(index);
+                       o.disabled.push( index );
                        o.disabled.sort();
 
-                       // callback
-                       this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
+                       this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
                }
 
                return this;
        },
 
-       select: function(index) {
-               if (typeof index == 'string') {
-                       index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
-               }
-               else if (index === null) { // usage of null is deprecated, TODO remove in next release
-                       index = -1;
-               }
-               if (index == -1 && this.options.collapsible) {
-                       index = this.options.selected;
+       select: function( index ) {
+               index = this._getIndex( index );
+               if ( index == -1 ) {
+                       if ( this.options.collapsible && this.options.selected != -1 ) {
+                               index = this.options.selected;
+                       } else {
+                               return this;
+                       }
                }
-
-               this.anchors.eq(index).trigger(this.options.event + '.tabs');
+               this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
                return this;
        },
 
-       load: function(index) {
-               var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs');
+       load: function( index ) {
+               index = this._getIndex( index );
+               var self = this,
+                       o = this.options,
+                       a = this.anchors.eq( index )[ 0 ],
+                       url = $.data( a, "load.tabs" );
 
                this.abort();
 
                // not remote or from cache
-               if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) {
-                       this.element.dequeue("tabs");
+               if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
+                       this.element.dequeue( "tabs" );
                        return;
                }
 
                // load remote from here on
-               this.lis.eq(index).addClass('ui-state-processing');
+               this.lis.eq( index ).addClass( "ui-state-processing" );
 
-               if (o.spinner) {
-                       var span = $('span', a);
-                       span.data('label.tabs', span.html()).html(o.spinner);
+               if ( o.spinner ) {
+                       var span = $( "span", a );
+                       span.data( "label.tabs", span.html() ).html( o.spinner );
                }
 
-               this.xhr = $.ajax($.extend({}, o.ajaxOptions, {
+               this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
                        url: url,
-                       success: function(r, s) {
-                               $(self._sanitizeSelector(a.hash)).html(r);
+                       success: function( r, s ) {
+                               self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
 
                                // take care of tab labels
                                self._cleanup();
 
-                               if (o.cache) {
-                                       $.data(a, 'cache.tabs', true); // if loaded once do not load them again
+                               if ( o.cache ) {
+                                       $.data( a, "cache.tabs", true );
                                }
 
-                               // callbacks
-                               self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
+                               self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
                                try {
-                                       o.ajaxOptions.success(r, s);
+                                       o.ajaxOptions.success( r, s );
                                }
-                               catch (e) {}
+                               catch ( e ) {}
                        },
-                       error: function(xhr, s, e) {
+                       error: function( xhr, s, e ) {
                                // take care of tab labels
                                self._cleanup();
 
-                               // callbacks
-                               self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
+                               self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
                                try {
                                        // Passing index avoid a race condition when this method is
                                        // called after the user has selected another tab.
                                        // Pass the anchor that initiated this request allows
                                        // loadError to manipulate the tab content panel via $(a.hash)
-                                       o.ajaxOptions.error(xhr, s, index, a);
+                                       o.ajaxOptions.error( xhr, s, index, a );
                                }
-                               catch (e) {}
+                               catch ( e ) {}
                        }
-               }));
+               } ) );
 
                // last, so that load event is fired before show...
-               self.element.dequeue("tabs");
+               self.element.dequeue( "tabs" );
 
                return this;
        },
 
        abort: function() {
                // stop possibly running animations
-               this.element.queue([]);
-               this.panels.stop(false, true);
+               this.element.queue( [] );
+               this.panels.stop( false, true );
 
                // "tabs" queue must not contain more than two elements,
                // which are the callbacks for the latest clicked tab...
-               this.element.queue("tabs", this.element.queue("tabs").splice(-2, 2));
+               this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
 
                // terminate pending requests from other tabs
-               if (this.xhr) {
+               if ( this.xhr ) {
                        this.xhr.abort();
                        delete this.xhr;
                }
@@ -656,19 +687,18 @@ $.widget("ui.tabs", {
                return this;
        },
 
-       url: function(index, url) {
-               this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
+       url: function( index, url ) {
+               this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
                return this;
        },
 
        length: function() {
                return this.anchors.length;
        }
-
 });
 
-$.extend($.ui.tabs, {
-       version: '1.8.2'
+$.extend( $.ui.tabs, {
+       version: "1.8.11"
 });
 
 /*
@@ -678,46 +708,45 @@ $.extend($.ui.tabs, {
 /*
  * Rotate
  */
-$.extend($.ui.tabs.prototype, {
+$.extend( $.ui.tabs.prototype, {
        rotation: null,
-       rotate: function(ms, continuing) {
+       rotate: function( ms, continuing ) {
+               var self = this,
+                       o = this.options;
 
-               var self = this, o = this.options;
-               
-               var rotate = self._rotate || (self._rotate = function(e) {
-                       clearTimeout(self.rotation);
+               var rotate = self._rotate || ( self._rotate = function( e ) {
+                       clearTimeout( self.rotation );
                        self.rotation = setTimeout(function() {
                                var t = o.selected;
                                self.select( ++t < self.anchors.length ? t : 0 );
-                       }, ms);
+                       }, ms );
                        
-                       if (e) {
+                       if ( e ) {
                                e.stopPropagation();
                        }
                });
-               
-               var stop = self._unrotate || (self._unrotate = !continuing ?
-                       function(e) {
+
+               var stop = self._unrotate || ( self._unrotate = !continuing
+                       function(e) {
                                if (e.clientX) { // in case of a true click
                                        self.rotate(null);
                                }
-                       } :
-                       function(e) {
+                       }
+                       : function( e ) {
                                t = o.selected;
                                rotate();
                        });
 
                // start rotation
-               if (ms) {
-                       this.element.bind('tabsshow', rotate);
-                       this.anchors.bind(o.event + '.tabs', stop);
+               if ( ms ) {
+                       this.element.bind( "tabsshow", rotate );
+                       this.anchors.bind( o.event + ".tabs", stop );
                        rotate();
-               }
                // stop rotation
-               else {
-                       clearTimeout(self.rotation);
-                       this.element.unbind('tabsshow', rotate);
-                       this.anchors.unbind(o.event + '.tabs', stop);
+               else {
+                       clearTimeout( self.rotation );
+                       this.element.unbind( "tabsshow", rotate );
+                       this.anchors.unbind( o.event + ".tabs", stop );
                        delete this._rotate;
                        delete this._unrotate;
                }
@@ -726,4 +755,4 @@ $.extend($.ui.tabs.prototype, {
        }
 });
 
-})(jQuery);
+})( jQuery );
index 6425d08..b6b1bee 100644 (file)
@@ -1,28 +1,38 @@
 /*!
- * jQuery UI Widget 1.8.2
+ * jQuery UI Widget 1.8.11
  *
- * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
  *
  * http://docs.jquery.com/UI/Widget
  */
-(function( $ ) {
-
-var _remove = $.fn.remove;
-
-$.fn.remove = function( selector, keepData ) {
-       return this.each(function() {
-               if ( !keepData ) {
-                       if ( !selector || $.filter( selector, [ this ] ).length ) {
-                               $( "*", this ).add( this ).each(function() {
-                                       $( this ).triggerHandler( "remove" );
-                               });
-                       }
+(function( $, undefined ) {
+
+// jQuery 1.4+
+if ( $.cleanData ) {
+       var _cleanData = $.cleanData;
+       $.cleanData = function( elems ) {
+               for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+                       $( elem ).triggerHandler( "remove" );
                }
-               return _remove.call( $(this), selector, keepData );
-       });
-};
+               _cleanData( elems );
+       };
+} else {
+       var _remove = $.fn.remove;
+       $.fn.remove = function( selector, keepData ) {
+               return this.each(function() {
+                       if ( !keepData ) {
+                               if ( !selector || $.filter( selector, [ this ] ).length ) {
+                                       $( "*", this ).add( [ this ] ).each(function() {
+                                               $( this ).triggerHandler( "remove" );
+                                       });
+                               }
+                       }
+                       return _remove.call( $(this), selector, keepData );
+               });
+       };
+}
 
 $.widget = function( name, base, prototype ) {
        var namespace = name.split( "." )[ 0 ],
@@ -57,7 +67,7 @@ $.widget = function( name, base, prototype ) {
 //                     basePrototype[ key ] = $.extend( {}, val );
 //             }
 //     });
-       basePrototype.options = $.extend( {}, basePrototype.options );
+       basePrototype.options = $.extend( true, {}, basePrototype.options );
        $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
                namespace: namespace,
                widgetName: name,
@@ -80,7 +90,7 @@ $.widget.bridge = function( name, object ) {
                        options;
 
                // prevent calls to internal methods
-               if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
+               if ( isMethodCall && options.charAt( 0 ) === "_" ) {
                        return returnValue;
                }
 
@@ -90,6 +100,15 @@ $.widget.bridge = function( name, object ) {
                                        methodValue = instance && $.isFunction( instance[options] ) ?
                                                instance[ options ].apply( instance, args ) :
                                                instance;
+                               // TODO: add this back in 1.9 and use $.error() (see #5972)
+//                             if ( !instance ) {
+//                                     throw "cannot call methods on " + name + " prior to initialization; " +
+//                                             "attempted to call method '" + options + "'";
+//                             }
+//                             if ( !$.isFunction( instance[options] ) ) {
+//                                     throw "no such method '" + options + "' for " + name + " widget instance";
+//                             }
+//                             var methodValue = instance[ options ].apply( instance, args );
                                if ( methodValue !== instance && methodValue !== undefined ) {
                                        returnValue = methodValue;
                                        return false;
@@ -99,10 +118,7 @@ $.widget.bridge = function( name, object ) {
                        this.each(function() {
                                var instance = $.data( this, name );
                                if ( instance ) {
-                                       if ( options ) {
-                                               instance.option( options );
-                                       }
-                                       instance._init();
+                                       instance.option( options || {} )._init();
                                } else {
                                        $.data( this, name, new object( options, this ) );
                                }
@@ -129,10 +145,11 @@ $.Widget.prototype = {
        _createWidget: function( options, element ) {
                // $.widget.bridge stores the plugin instance, but we do it anyway
                // so that it's stored even before the _create function runs
-               this.element = $( element ).data( this.widgetName, this );
+               $.data( element, this.widgetName, this );
+               this.element = $( element );
                this.options = $.extend( true, {},
                        this.options,
-                       $.metadata && $.metadata.get( element )[ this.widgetName ],
+                       this._getCreateOptions(),
                        options );
 
                var self = this;
@@ -141,8 +158,12 @@ $.Widget.prototype = {
                });
 
                this._create();
+               this._trigger( "create" );
                this._init();
        },
+       _getCreateOptions: function() {
+               return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
+       },
        _create: function() {},
        _init: function() {},
 
@@ -163,12 +184,11 @@ $.Widget.prototype = {
        },
 
        option: function( key, value ) {
-               var options = key,
-                       self = this;
+               var options = key;
 
                if ( arguments.length === 0 ) {
                        // don't return a reference to the internal hash
-                       return $.extend( {}, self.options );
+                       return $.extend( {}, this.options );
                }
 
                if  (typeof key === "string" ) {
@@ -179,11 +199,17 @@ $.Widget.prototype = {
                        options[ key ] = value;
                }
 
+               this._setOptions( options );
+
+               return this;
+       },
+       _setOptions: function( options ) {
+               var self = this;
                $.each( options, function( key, value ) {
                        self._setOption( key, value );
                });
 
-               return self;
+               return this;
        },
        _setOption: function( key, value ) {
                this.options[ key ] = value;
index 5507c42..97cfcda 100644 (file)
@@ -29,7 +29,7 @@ input.ui-button { padding: .4em 1em; }
 /* workarounds */
 button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
 
-body button.ui-button {
+body .ui-button {
        -moz-border-radius: 4px;
        -webkit-border-radius: 4px;
        padding: 0.2em 0.6em 0.15em !important;
@@ -43,18 +43,18 @@ body button.ui-button {
        width: auto;
        overflow: visible;
 }
-body button.ui-button:hover {
+body .ui-button:hover {
        border-color: #6e7273;
        /* @embed */
        background: #e1e1e1 url(images/button-over.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button:active,
-body button.ui-button:focus {
+body .ui-button:active,
+body .ui-button:focus {
        border-color: #707271;
        /* @embed */
        background: #bfbfbf url(images/button-down.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.disabled {
+body .ui-button.disabled {
        color: #7f7f7f;
        border-color: #cccccc;
        /* @embed */
@@ -67,24 +67,24 @@ body  button.ui-button::-moz-focus-inner {
 
 /* Green buttons */
 
-body button.ui-button.ui-button-green {
+body .ui-button.ui-button-green {
        color: white;
        border-color: #97af7e !important;
        /* @embed */
        background: #85c940 url(images/button-off-green.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-green:hover {
+body .ui-button.ui-button-green:hover {
        border-color: #778e61;
        /* @embed */
        background: #77ad40 url(images/button-over-green.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-green:active,
-body button.ui-button.ui-button-green:focus {
+body .ui-button.ui-button-green:active,
+body .ui-button.ui-button-green:focus {
        border-color: #61b000;
        /* @embed */
        background: #54a800 url(images/button-down-green.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-green.disabled {
+body .ui-button.ui-button-green.disabled {
        color: #7f7f7f;
        border-color: #b8d29f;
        /* @embed */
@@ -93,24 +93,24 @@ body button.ui-button.ui-button-green.disabled {
 
 /* Blue buttons */
 
-body button.ui-button.ui-button-blue {
+body .ui-button.ui-button-blue {
        color: white;
        border-color: #407ec9 !important;
        /* @embed */
        background: #407ec9 url(images/button-off-blue.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-blue:hover {
+body .ui-button.ui-button-blue:hover {
        border-color: #245289;
        /* @embed */
        background: #4071ad url(images/button-over-blue.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-blue:active,
-body button.ui-button.ui-button-blue:focus {
+body .ui-button.ui-button-blue:active,
+body .ui-button.ui-button-blue:focus {
        border-color: #003980;
        /* @embed */
        background: #004daa url(images/button-down-blue.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-blue.disabled {
+body .ui-button.ui-button-blue.disabled {
        border-color: #9eafc6;
        /* @embed */
        background: #c3c8cf url(images/button-disabled-blue.png) repeat-x scroll 50% 100% !important;   
@@ -118,24 +118,24 @@ body button.ui-button.ui-button-blue.disabled {
 
 /* Red buttons */
 
-body button.ui-button.ui-button-red {
+body .ui-button.ui-button-red {
        color: white;
        border-color: #af977e !important;
        /* @embed */
        background: #c9404c url(images/button-off-red.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-red:hover {
+body .ui-button.ui-button-red:hover {
        border-color: #8e7761;
        /* @embed */
        background: #ad404a url(images/button-over-red.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-red:active,
-body button.ui-button.ui-button-red:focus {
+body .ui-button.ui-button-red:active,
+body .ui-button.ui-button-red:focus {
        border-color: #b06100;
        /* @embed */
        background: #aa000f url(images/button-down-red.png) repeat-x scroll 50% 100% !important;
 }
-body button.ui-button.ui-button-red.disabled {
+body .ui-button.ui-button-red.disabled {
        color: #7f7f7f;
        border-color: #c3acae;
        /* @embed */