r86046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86045‎ | r86046 | r86047 >
Date:13:09, 14 April 2011
Author:diebuche
Status:ok
Tags:
Comment:
Updating jQuery UI to 1.8.11 (was 1.8.2). Also loosening button css, since j.ui.button works for non <button> elements as well
Modified paths:
  • /trunk/phase3/resources/jquery.ui/jquery.ui.accordion.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.autocomplete.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.button.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.core.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.datepicker.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.dialog.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.draggable.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.droppable.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.mouse.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.position.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.progressbar.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.resizable.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.selectable.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.slider.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.sortable.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.tabs.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/jquery.ui.widget.js (modified) (history)
  • /trunk/phase3/resources/jquery.ui/themes/vector/jquery.ui.button.css (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery.ui/jquery.ui.button.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Button 1.8.2
 3+ * jQuery UI Button 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Button
1010 *
@@ -11,12 +11,12 @@
1212 * jquery.ui.core.js
1313 * jquery.ui.widget.js
1414 */
15 -(function( $ ) {
 15+(function( $, undefined ) {
1616
1717 var lastActive,
1818 baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
1919 stateClasses = "ui-state-hover ui-state-active ",
20 - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only",
 20+ 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",
2121 formResetHandler = function( event ) {
2222 $( ":ui-button", event.target.form ).each(function() {
2323 var inst = $( this ).data( "button" );
@@ -44,6 +44,7 @@
4545
4646 $.widget( "ui.button", {
4747 options: {
 48+ disabled: null,
4849 text: true,
4950 label: null,
5051 icons: {
@@ -56,6 +57,10 @@
5758 .unbind( "reset.button" )
5859 .bind( "reset.button", formResetHandler );
5960
 61+ if ( typeof this.options.disabled !== "boolean" ) {
 62+ this.options.disabled = this.element.attr( "disabled" );
 63+ }
 64+
6065 this._determineButtonType();
6166 this.hasTitle = !!this.buttonElement.attr( "title" );
6267
@@ -195,8 +200,16 @@
196201 if ( this.type === "checkbox" || this.type === "radio" ) {
197202 // we don't search against the document in case the element
198203 // is disconnected from the DOM
199 - this.buttonElement = this.element.parents().last()
200 - .find( "[for=" + this.element.attr("id") + "]" );
 204+ var ancestor = this.element.parents().filter(":last"),
 205+ labelSelector = "label[for=" + this.element.attr("id") + "]";
 206+ this.buttonElement = ancestor.find( labelSelector );
 207+ if ( !this.buttonElement.length ) {
 208+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
 209+ this.buttonElement = ancestor.filter( labelSelector );
 210+ if ( !this.buttonElement.length ) {
 211+ this.buttonElement = ancestor.find( labelSelector );
 212+ }
 213+ }
201214 this.element.addClass( "ui-helper-hidden-accessible" );
202215
203216 var checked = this.element.is( ":checked" );
@@ -285,34 +298,43 @@
286299 .appendTo( buttonElement.empty() )
287300 .text(),
288301 icons = this.options.icons,
289 - multipleIcons = icons.primary && icons.secondary;
 302+ multipleIcons = icons.primary && icons.secondary,
 303+ buttonClasses = [];
 304+
290305 if ( icons.primary || icons.secondary ) {
291 - buttonElement.addClass( "ui-button-text-icon" +
292 - ( multipleIcons ? "s" : "" ) );
 306+ if ( this.options.text ) {
 307+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
 308+ }
 309+
293310 if ( icons.primary ) {
294311 buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
295312 }
 313+
296314 if ( icons.secondary ) {
297315 buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
298316 }
 317+
299318 if ( !this.options.text ) {
300 - buttonElement
301 - .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
302 - .removeClass( "ui-button-text-icons ui-button-text-icon" );
 319+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
 320+
303321 if ( !this.hasTitle ) {
304322 buttonElement.attr( "title", buttonText );
305323 }
306324 }
307325 } else {
308 - buttonElement.addClass( "ui-button-text-only" );
 326+ buttonClasses.push( "ui-button-text-only" );
309327 }
 328+ buttonElement.addClass( buttonClasses.join( " " ) );
310329 }
311330 });
312331
313332 $.widget( "ui.buttonset", {
 333+ options: {
 334+ items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
 335+ },
 336+
314337 _create: function() {
315338 this.element.addClass( "ui-buttonset" );
316 - this._init();
317339 },
318340
319341 _init: function() {
@@ -328,7 +350,7 @@
329351 },
330352
331353 refresh: function() {
332 - this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
 354+ this.buttons = this.element.find( this.options.items )
333355 .filter( ":ui-button" )
334356 .button( "refresh" )
335357 .end()
Index: trunk/phase3/resources/jquery.ui/jquery.ui.datepicker.js
@@ -1,20 +1,19 @@
22 /*
3 - * jQuery UI Datepicker 1.8.2
 3+ * jQuery UI Datepicker 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Datepicker
1010 *
1111 * Depends:
1212 * jquery.ui.core.js
1313 */
 14+(function( $, undefined ) {
1415
15 -(function($) { // hide the namespace
 16+$.extend($.ui, { datepicker: { version: "1.8.11" } });
1617
17 -$.extend($.ui, { datepicker: { version: "1.8.2" } });
18 -
1918 var PROP_NAME = 'datepicker';
2019 var dpuuid = new Date().getTime();
2120
@@ -108,7 +107,7 @@
109108 autoSize: false // True to size the input for the date format, false to leave as is
110109 };
111110 $.extend(this._defaults, this.regional['']);
112 - 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>');
 111+ this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>');
113112 }
114113
115114 $.extend(Datepicker.prototype, {
@@ -168,7 +167,7 @@
169168
170169 /* Create a new instance object. */
171170 _newInst: function(target, inline) {
172 - var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars
 171+ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
173172 return {id: id, input: target, // associated target
174173 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
175174 drawMonth: 0, drawYear: 0, // month being drawn
@@ -273,6 +272,7 @@
274273 this._setDate(inst, this._getDefaultDate(inst), true);
275274 this._updateDatepicker(inst);
276275 this._updateAlternate(inst);
 276+ inst.dpDiv.show();
277277 },
278278
279279 /* Pop-up the date picker in a "dialog" box.
@@ -444,7 +444,14 @@
445445 this._hideDatepicker();
446446 }
447447 var date = this._getDateDatepicker(target, true);
 448+ var minDate = this._getMinMaxDate(inst, 'min');
 449+ var maxDate = this._getMinMaxDate(inst, 'max');
448450 extendRemove(inst.settings, settings);
 451+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
 452+ if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
 453+ inst.settings.minDate = this._formatDate(inst, minDate);
 454+ if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
 455+ inst.settings.maxDate = this._formatDate(inst, maxDate);
449456 this._attachments($(target), inst);
450457 this._autoSize(inst);
451458 this._setDateDatepicker(target, date);
@@ -500,8 +507,8 @@
501508 case 9: $.datepicker._hideDatepicker();
502509 handled = false;
503510 break; // hide on tab out
504 - case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).
505 - add($('td.' + $.datepicker._currentClass, inst.dpDiv));
 511+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
 512+ $.datepicker._currentClass + ')', inst.dpDiv);
506513 if (sel[0])
507514 $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
508515 else
@@ -565,7 +572,7 @@
566573 if ($.datepicker._get(inst, 'constrainInput')) {
567574 var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
568575 var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
569 - return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
 576+ return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
570577 }
571578 },
572579
@@ -625,6 +632,8 @@
626633 }
627634 var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
628635 $.datepicker._pos = null;
 636+ //to avoid flashes on Firefox
 637+ inst.dpDiv.empty();
629638 // determine sizing offscreen
630639 inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
631640 $.datepicker._updateDatepicker(inst);
@@ -639,10 +648,12 @@
640649 var duration = $.datepicker._get(inst, 'duration');
641650 var postProcess = function() {
642651 $.datepicker._datepickerShowing = true;
643 - var borders = $.datepicker._getBorders(inst.dpDiv);
644 - inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only
645 - css({left: -borders[0], top: -borders[1],
 652+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
 653+ if( !! cover.length ){
 654+ var borders = $.datepicker._getBorders(inst.dpDiv);
 655+ cover.css({left: -borders[0], top: -borders[1],
646656 width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
 657+ }
647658 };
648659 inst.dpDiv.zIndex($(input).zIndex()+1);
649660 if ($.effects && $.effects[showAnim])
@@ -661,12 +672,12 @@
662673 _updateDatepicker: function(inst) {
663674 var self = this;
664675 var borders = $.datepicker._getBorders(inst.dpDiv);
665 - inst.dpDiv.empty().append(this._generateHTML(inst))
666 - .find('iframe.ui-datepicker-cover') // IE6- only
667 - .css({left: -borders[0], top: -borders[1],
668 - width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
669 - .end()
670 - .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
 676+ inst.dpDiv.empty().append(this._generateHTML(inst));
 677+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
 678+ if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
 679+ cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
 680+ }
 681+ inst.dpDiv.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
671682 .bind('mouseout', function(){
672683 $(this).removeClass('ui-state-hover');
673684 if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
@@ -696,8 +707,21 @@
697708 inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
698709 'Class']('ui-datepicker-rtl');
699710 if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
700 - inst.input.is(':visible') && !inst.input.is(':disabled'))
 711+ // #6694 - don't focus the input if it's already focused
 712+ // this breaks the change event in IE
 713+ inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
701714 inst.input.focus();
 715+ // deffered render of the years select (to avoid flashes on Firefox)
 716+ if( inst.yearshtml ){
 717+ var origyearshtml = inst.yearshtml;
 718+ setTimeout(function(){
 719+ //assure that inst.yearshtml didn't change.
 720+ if( origyearshtml === inst.yearshtml ){
 721+ inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
 722+ }
 723+ origyearshtml = inst.yearshtml = null;
 724+ }, 0);
 725+ }
702726 },
703727
704728 /* Retrieve the size of left and top borders for an element.
@@ -737,7 +761,7 @@
738762 _findPos: function(obj) {
739763 var inst = this._getInst(obj);
740764 var isRTL = this._get(inst, 'isRTL');
741 - while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
 765+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
742766 obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
743767 }
744768 var position = $(obj).offset();
@@ -847,8 +871,11 @@
848872 _clickMonthYear: function(id) {
849873 var target = $(id);
850874 var inst = this._getInst(target[0]);
851 - if (inst.input && inst._selectingMonthYear && !$.browser.msie)
852 - inst.input.focus();
 875+ if (inst.input && inst._selectingMonthYear) {
 876+ setTimeout(function() {
 877+ inst.input.focus();
 878+ }, 0);
 879+ }
853880 inst._selectingMonthYear = !inst._selectingMonthYear;
854881 },
855882
@@ -948,6 +975,8 @@
949976 if (value == '')
950977 return null;
951978 var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
 979+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
 980+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
952981 var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
953982 var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
954983 var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
@@ -966,9 +995,9 @@
967996 };
968997 // Extract a number from the string value
969998 var getNumber = function(match) {
970 - lookAhead(match);
 999+ var isDoubled = lookAhead(match);
9711000 var size = (match == '@' ? 14 : (match == '!' ? 20 :
972 - (match == 'y' ? 4 : (match == 'o' ? 3 : 2))));
 1001+ (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
9731002 var digits = new RegExp('^\\d{1,' + size + '}');
9741003 var num = value.substring(iValue).match(digits);
9751004 if (!num)
@@ -980,7 +1009,7 @@
9811010 var getName = function(match, shortNames, longNames) {
9821011 var names = (lookAhead(match) ? longNames : shortNames);
9831012 for (var i = 0; i < names.length; i++) {
984 - if (value.substr(iValue, names[i].length) == names[i]) {
 1013+ if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
9851014 iValue += names[i].length;
9861015 return i + 1;
9871016 }
@@ -1298,16 +1327,16 @@
12991328 }
13001329 return new Date(year, month, day);
13011330 };
1302 - date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :
1303 - (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
1304 - date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
1305 - if (date) {
1306 - date.setHours(0);
1307 - date.setMinutes(0);
1308 - date.setSeconds(0);
1309 - date.setMilliseconds(0);
 1331+ var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
 1332+ (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
 1333+ newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
 1334+ if (newDate) {
 1335+ newDate.setHours(0);
 1336+ newDate.setMinutes(0);
 1337+ newDate.setSeconds(0);
 1338+ newDate.setMilliseconds(0);
13101339 }
1311 - return this._daylightSavingAdjust(date);
 1340+ return this._daylightSavingAdjust(newDate);
13121341 },
13131342
13141343 /* Handle switch to/from daylight saving.
@@ -1324,13 +1353,13 @@
13251354
13261355 /* Set the date(s) directly. */
13271356 _setDate: function(inst, date, noChange) {
1328 - var clear = !(date);
 1357+ var clear = !date;
13291358 var origMonth = inst.selectedMonth;
13301359 var origYear = inst.selectedYear;
1331 - date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
1332 - inst.selectedDay = inst.currentDay = date.getDate();
1333 - inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
1334 - inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
 1360+ var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
 1361+ inst.selectedDay = inst.currentDay = newDate.getDate();
 1362+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
 1363+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
13351364 if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
13361365 this._notifyChange(inst);
13371366 this._adjustInstDate(inst);
@@ -1546,6 +1575,7 @@
15471576 if (!showMonthAfterYear)
15481577 html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
15491578 // year selection
 1579+ inst.yearshtml = '';
15501580 if (secondary || !changeYear)
15511581 html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
15521582 else {
@@ -1562,16 +1592,24 @@
15631593 var endYear = Math.max(year, determineYear(years[1] || ''));
15641594 year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
15651595 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
1566 - html += '<select class="ui-datepicker-year" ' +
 1596+ inst.yearshtml += '<select class="ui-datepicker-year" ' +
15671597 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
15681598 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
15691599 '>';
15701600 for (; year <= endYear; year++) {
1571 - html += '<option value="' + year + '"' +
 1601+ inst.yearshtml += '<option value="' + year + '"' +
15721602 (year == drawYear ? ' selected="selected"' : '') +
15731603 '>' + year + '</option>';
15741604 }
1575 - html += '</select>';
 1605+ inst.yearshtml += '</select>';
 1606+ //when showing there is no need for later update
 1607+ if( ! $.browser.mozilla ){
 1608+ html += inst.yearshtml;
 1609+ inst.yearshtml = null;
 1610+ } else {
 1611+ // will be replaced later with inst.yearshtml
 1612+ html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>';
 1613+ }
15761614 }
15771615 html += this._get(inst, 'yearSuffix');
15781616 if (showMonthAfterYear)
@@ -1599,9 +1637,9 @@
16001638 _restrictMinMax: function(inst, date) {
16011639 var minDate = this._getMinMaxDate(inst, 'min');
16021640 var maxDate = this._getMinMaxDate(inst, 'max');
1603 - date = (minDate && date < minDate ? minDate : date);
1604 - date = (maxDate && date > maxDate ? maxDate : date);
1605 - return date;
 1641+ var newDate = (minDate && date < minDate ? minDate : date);
 1642+ newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
 1643+ return newDate;
16061644 },
16071645
16081646 /* Notify change of month/year. */
@@ -1625,7 +1663,7 @@
16261664
16271665 /* Find the number of days in a given month. */
16281666 _getDaysInMonth: function(year, month) {
1629 - return 32 - new Date(year, month, 32).getDate();
 1667+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
16301668 },
16311669
16321670 /* Find the day of the week of the first of a month. */
@@ -1695,7 +1733,12 @@
16961734 Object - settings for attaching new datepicker functionality
16971735 @return jQuery object */
16981736 $.fn.datepicker = function(options){
1699 -
 1737+
 1738+ /* Verify an empty collection wasn't passed - Fixes #6976 */
 1739+ if ( !this.length ) {
 1740+ return this;
 1741+ }
 1742+
17001743 /* Initialise the date picker. */
17011744 if (!$.datepicker.initialized) {
17021745 $(document).mousedown($.datepicker._checkExternalClick).
@@ -1721,7 +1764,7 @@
17221765 $.datepicker = new Datepicker(); // singleton instance
17231766 $.datepicker.initialized = false;
17241767 $.datepicker.uuid = new Date().getTime();
1725 -$.datepicker.version = "1.8.2";
 1768+$.datepicker.version = "1.8.11";
17261769
17271770 // Workaround for #4055
17281771 // Add another global to avoid noConflict issues with inline event handlers
Index: trunk/phase3/resources/jquery.ui/jquery.ui.sortable.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Sortable 1.8.2
 3+ * jQuery UI Sortable 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Sortables
1010 *
@@ -12,7 +12,7 @@
1313 * jquery.ui.mouse.js
1414 * jquery.ui.widget.js
1515 */
16 -(function($) {
 16+(function( $, undefined ) {
1717
1818 $.widget("ui.sortable", $.ui.mouse, {
1919 widgetEventPrefix: "sort",
@@ -49,8 +49,8 @@
5050 //Get the items
5151 this.refresh();
5252
53 - //Let's determine if the items are floating
54 - this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
 53+ //Let's determine if the items are being displayed horizontally
 54+ 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;
5555
5656 //Let's determine the parent's offset
5757 this.offset = this.element.offset();
@@ -360,7 +360,7 @@
361361
362362 if(this.dragging) {
363363
364 - this._mouseUp();
 364+ this._mouseUp({ target: null });
365365
366366 if(this.options.helper == "original")
367367 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
@@ -378,21 +378,23 @@
379379
380380 }
381381
382 - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
383 - if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
384 - if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
 382+ if (this.placeholder) {
 383+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
 384+ if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
 385+ if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
385386
386 - $.extend(this, {
387 - helper: null,
388 - dragging: false,
389 - reverting: false,
390 - _noFinalSort: null
391 - });
 387+ $.extend(this, {
 388+ helper: null,
 389+ dragging: false,
 390+ reverting: false,
 391+ _noFinalSort: null
 392+ });
392393
393 - if(this.domPosition.prev) {
394 - $(this.domPosition.prev).after(this.currentItem);
395 - } else {
396 - $(this.domPosition.parent).prepend(this.currentItem);
 394+ if(this.domPosition.prev) {
 395+ $(this.domPosition.prev).after(this.currentItem);
 396+ } else {
 397+ $(this.domPosition.parent).prepend(this.currentItem);
 398+ }
397399 }
398400
399401 return this;
@@ -409,6 +411,10 @@
410412 if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
411413 });
412414
 415+ if(!str.length && o.key) {
 416+ str.push(o.key + '=');
 417+ }
 418+
413419 return str.join('&');
414420
415421 },
@@ -1061,7 +1067,7 @@
10621068 });
10631069
10641070 $.extend($.ui.sortable, {
1065 - version: "1.8.2"
 1071+ version: "1.8.11"
10661072 });
10671073
10681074 })(jQuery);
Index: trunk/phase3/resources/jquery.ui/themes/vector/jquery.ui.button.css
@@ -29,7 +29,7 @@
3030 /* workarounds */
3131 button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
3232
33 -body button.ui-button {
 33+body .ui-button {
3434 -moz-border-radius: 4px;
3535 -webkit-border-radius: 4px;
3636 padding: 0.2em 0.6em 0.15em !important;
@@ -43,18 +43,18 @@
4444 width: auto;
4545 overflow: visible;
4646 }
47 -body button.ui-button:hover {
 47+body .ui-button:hover {
4848 border-color: #6e7273;
4949 /* @embed */
5050 background: #e1e1e1 url(images/button-over.png) repeat-x scroll 50% 100% !important;
5151 }
52 -body button.ui-button:active,
53 -body button.ui-button:focus {
 52+body .ui-button:active,
 53+body .ui-button:focus {
5454 border-color: #707271;
5555 /* @embed */
5656 background: #bfbfbf url(images/button-down.png) repeat-x scroll 50% 100% !important;
5757 }
58 -body button.ui-button.disabled {
 58+body .ui-button.disabled {
5959 color: #7f7f7f;
6060 border-color: #cccccc;
6161 /* @embed */
@@ -67,24 +67,24 @@
6868
6969 /* Green buttons */
7070
71 -body button.ui-button.ui-button-green {
 71+body .ui-button.ui-button-green {
7272 color: white;
7373 border-color: #97af7e !important;
7474 /* @embed */
7575 background: #85c940 url(images/button-off-green.png) repeat-x scroll 50% 100% !important;
7676 }
77 -body button.ui-button.ui-button-green:hover {
 77+body .ui-button.ui-button-green:hover {
7878 border-color: #778e61;
7979 /* @embed */
8080 background: #77ad40 url(images/button-over-green.png) repeat-x scroll 50% 100% !important;
8181 }
82 -body button.ui-button.ui-button-green:active,
83 -body button.ui-button.ui-button-green:focus {
 82+body .ui-button.ui-button-green:active,
 83+body .ui-button.ui-button-green:focus {
8484 border-color: #61b000;
8585 /* @embed */
8686 background: #54a800 url(images/button-down-green.png) repeat-x scroll 50% 100% !important;
8787 }
88 -body button.ui-button.ui-button-green.disabled {
 88+body .ui-button.ui-button-green.disabled {
8989 color: #7f7f7f;
9090 border-color: #b8d29f;
9191 /* @embed */
@@ -93,24 +93,24 @@
9494
9595 /* Blue buttons */
9696
97 -body button.ui-button.ui-button-blue {
 97+body .ui-button.ui-button-blue {
9898 color: white;
9999 border-color: #407ec9 !important;
100100 /* @embed */
101101 background: #407ec9 url(images/button-off-blue.png) repeat-x scroll 50% 100% !important;
102102 }
103 -body button.ui-button.ui-button-blue:hover {
 103+body .ui-button.ui-button-blue:hover {
104104 border-color: #245289;
105105 /* @embed */
106106 background: #4071ad url(images/button-over-blue.png) repeat-x scroll 50% 100% !important;
107107 }
108 -body button.ui-button.ui-button-blue:active,
109 -body button.ui-button.ui-button-blue:focus {
 108+body .ui-button.ui-button-blue:active,
 109+body .ui-button.ui-button-blue:focus {
110110 border-color: #003980;
111111 /* @embed */
112112 background: #004daa url(images/button-down-blue.png) repeat-x scroll 50% 100% !important;
113113 }
114 -body button.ui-button.ui-button-blue.disabled {
 114+body .ui-button.ui-button-blue.disabled {
115115 border-color: #9eafc6;
116116 /* @embed */
117117 background: #c3c8cf url(images/button-disabled-blue.png) repeat-x scroll 50% 100% !important;
@@ -118,24 +118,24 @@
119119
120120 /* Red buttons */
121121
122 -body button.ui-button.ui-button-red {
 122+body .ui-button.ui-button-red {
123123 color: white;
124124 border-color: #af977e !important;
125125 /* @embed */
126126 background: #c9404c url(images/button-off-red.png) repeat-x scroll 50% 100% !important;
127127 }
128 -body button.ui-button.ui-button-red:hover {
 128+body .ui-button.ui-button-red:hover {
129129 border-color: #8e7761;
130130 /* @embed */
131131 background: #ad404a url(images/button-over-red.png) repeat-x scroll 50% 100% !important;
132132 }
133 -body button.ui-button.ui-button-red:active,
134 -body button.ui-button.ui-button-red:focus {
 133+body .ui-button.ui-button-red:active,
 134+body .ui-button.ui-button-red:focus {
135135 border-color: #b06100;
136136 /* @embed */
137137 background: #aa000f url(images/button-down-red.png) repeat-x scroll 50% 100% !important;
138138 }
139 -body button.ui-button.ui-button-red.disabled {
 139+body .ui-button.ui-button-red.disabled {
140140 color: #7f7f7f;
141141 border-color: #c3acae;
142142 /* @embed */
Index: trunk/phase3/resources/jquery.ui/jquery.ui.resizable.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Resizable 1.8.2
 3+ * jQuery UI Resizable 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Resizables
1010 *
@@ -12,7 +12,7 @@
1313 * jquery.ui.mouse.js
1414 * jquery.ui.widget.js
1515 */
16 -(function($) {
 16+(function( $, undefined ) {
1717
1818 $.widget("ui.resizable", $.ui.mouse, {
1919 widgetEventPrefix: "resize",
@@ -322,10 +322,10 @@
323323
324324 if(this._helper) {
325325 var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
326 - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
327 - soffsetw = ista ? 0 : self.sizeDiff.width;
 326+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
 327+ soffsetw = ista ? 0 : self.sizeDiff.width;
328328
329 - var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
 329+ var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
330330 left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
331331 top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
332332
@@ -519,7 +519,7 @@
520520 });
521521
522522 $.extend($.ui.resizable, {
523 - version: "1.8.2"
 523+ version: "1.8.11"
524524 });
525525
526526 /*
@@ -528,28 +528,29 @@
529529
530530 $.ui.plugin.add("resizable", "alsoResize", {
531531
532 - start: function(event, ui) {
533 -
 532+ start: function (event, ui) {
534533 var self = $(this).data("resizable"), o = self.options;
535534
536 - var _store = function(exp) {
 535+ var _store = function (exp) {
537536 $(exp).each(function() {
538 - $(this).data("resizable-alsoresize", {
539 - width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
540 - left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
 537+ var el = $(this);
 538+ el.data("resizable-alsoresize", {
 539+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
 540+ left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
 541+ position: el.css('position') // to reset Opera on stop()
541542 });
542543 });
543544 };
544545
545546 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
546 - if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
547 - else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
 547+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
 548+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
548549 }else{
549550 _store(o.alsoResize);
550551 }
551552 },
552553
553 - resize: function(event, ui){
 554+ resize: function (event, ui) {
554555 var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
555556
556557 var delta = {
@@ -557,18 +558,19 @@
558559 top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
559560 },
560561
561 - _alsoResize = function(exp, c) {
 562+ _alsoResize = function (exp, c) {
562563 $(exp).each(function() {
563 - var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
 564+ var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
 565+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
564566
565 - $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
 567+ $.each(css, function (i, prop) {
566568 var sum = (start[prop]||0) + (delta[prop]||0);
567569 if (sum && sum >= 0)
568570 style[prop] = sum || null;
569571 });
570572
571 - //Opera fixing relative position
572 - if (/relative/.test(el.css('position')) && $.browser.opera) {
 573+ // Opera fixing relative position
 574+ if ($.browser.opera && /relative/.test(el.css('position'))) {
573575 self._revertToRelativePosition = true;
574576 el.css({ position: 'absolute', top: 'auto', left: 'auto' });
575577 }
@@ -578,22 +580,33 @@
579581 };
580582
581583 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
582 - $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
 584+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
583585 }else{
584586 _alsoResize(o.alsoResize);
585587 }
586588 },
587589
588 - stop: function(event, ui){
589 - var self = $(this).data("resizable");
 590+ stop: function (event, ui) {
 591+ var self = $(this).data("resizable"), o = self.options;
590592
591 - //Opera fixing relative position
592 - if (self._revertToRelativePosition && $.browser.opera) {
 593+ var _reset = function (exp) {
 594+ $(exp).each(function() {
 595+ var el = $(this);
 596+ // reset position for Opera - no need to verify it was changed
 597+ el.css({ position: el.data("resizable-alsoresize").position });
 598+ });
 599+ };
 600+
 601+ if (self._revertToRelativePosition) {
593602 self._revertToRelativePosition = false;
594 - el.css({ position: 'relative' });
 603+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
 604+ $.each(o.alsoResize, function (exp) { _reset(exp); });
 605+ }else{
 606+ _reset(o.alsoResize);
 607+ }
595608 }
596609
597 - $(this).removeData("resizable-alsoresize-start");
 610+ $(this).removeData("resizable-alsoresize");
598611 }
599612 });
600613
Index: trunk/phase3/resources/jquery.ui/jquery.ui.slider.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Slider 1.8.2
 3+ * jQuery UI Slider 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Slider
1010 *
@@ -12,9 +12,8 @@
1313 * jquery.ui.mouse.js
1414 * jquery.ui.widget.js
1515 */
 16+(function( $, undefined ) {
1617
17 -(function( $ ) {
18 -
1918 // number of pages in a slider
2019 // (how many times can you page up/down to go through the whole range)
2120 var numPages = 5;
@@ -310,8 +309,9 @@
311310 ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
312311 };
313312
314 - normValue = this._normValueFromMouse( position );
315 - this._slide( event, index, normValue );
 313+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
 314+ this._slide( event, index, normValue );
 315+ }
316316 this._animateOff = true;
317317 return true;
318318 },
@@ -585,14 +585,14 @@
586586
587587 // returns the step-aligned value that val is closest to, between (inclusive) min and max
588588 _trimAlignValue: function( val ) {
589 - if ( val < this._valueMin() ) {
 589+ if ( val <= this._valueMin() ) {
590590 return this._valueMin();
591591 }
592 - if ( val > this._valueMax() ) {
 592+ if ( val >= this._valueMax() ) {
593593 return this._valueMax();
594594 }
595595 var step = ( this.options.step > 0 ) ? this.options.step : 1,
596 - valModStep = val % step,
 596+ valModStep = (val - this._valueMin()) % step;
597597 alignValue = val - valModStep;
598598
599599 if ( Math.abs(valModStep) * 2 >= step ) {
@@ -676,7 +676,7 @@
677677 });
678678
679679 $.extend( $.ui.slider, {
680 - version: "1.8.2"
 680+ version: "1.8.11"
681681 });
682682
683683 }(jQuery));
Index: trunk/phase3/resources/jquery.ui/jquery.ui.widget.js
@@ -1,28 +1,38 @@
22 /*!
3 - * jQuery UI Widget 1.8.2
 3+ * jQuery UI Widget 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Widget
1010 */
11 -(function( $ ) {
 11+(function( $, undefined ) {
1212
13 -var _remove = $.fn.remove;
14 -
15 -$.fn.remove = function( selector, keepData ) {
16 - return this.each(function() {
17 - if ( !keepData ) {
18 - if ( !selector || $.filter( selector, [ this ] ).length ) {
19 - $( "*", this ).add( this ).each(function() {
20 - $( this ).triggerHandler( "remove" );
21 - });
 13+// jQuery 1.4+
 14+if ( $.cleanData ) {
 15+ var _cleanData = $.cleanData;
 16+ $.cleanData = function( elems ) {
 17+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
 18+ $( elem ).triggerHandler( "remove" );
 19+ }
 20+ _cleanData( elems );
 21+ };
 22+} else {
 23+ var _remove = $.fn.remove;
 24+ $.fn.remove = function( selector, keepData ) {
 25+ return this.each(function() {
 26+ if ( !keepData ) {
 27+ if ( !selector || $.filter( selector, [ this ] ).length ) {
 28+ $( "*", this ).add( [ this ] ).each(function() {
 29+ $( this ).triggerHandler( "remove" );
 30+ });
 31+ }
2232 }
23 - }
24 - return _remove.call( $(this), selector, keepData );
25 - });
26 -};
 33+ return _remove.call( $(this), selector, keepData );
 34+ });
 35+ };
 36+}
2737
2838 $.widget = function( name, base, prototype ) {
2939 var namespace = name.split( "." )[ 0 ],
@@ -57,7 +67,7 @@
5868 // basePrototype[ key ] = $.extend( {}, val );
5969 // }
6070 // });
61 - basePrototype.options = $.extend( {}, basePrototype.options );
 71+ basePrototype.options = $.extend( true, {}, basePrototype.options );
6272 $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
6373 namespace: namespace,
6474 widgetName: name,
@@ -80,7 +90,7 @@
8191 options;
8292
8393 // prevent calls to internal methods
84 - if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
 94+ if ( isMethodCall && options.charAt( 0 ) === "_" ) {
8595 return returnValue;
8696 }
8797
@@ -90,6 +100,15 @@
91101 methodValue = instance && $.isFunction( instance[options] ) ?
92102 instance[ options ].apply( instance, args ) :
93103 instance;
 104+ // TODO: add this back in 1.9 and use $.error() (see #5972)
 105+// if ( !instance ) {
 106+// throw "cannot call methods on " + name + " prior to initialization; " +
 107+// "attempted to call method '" + options + "'";
 108+// }
 109+// if ( !$.isFunction( instance[options] ) ) {
 110+// throw "no such method '" + options + "' for " + name + " widget instance";
 111+// }
 112+// var methodValue = instance[ options ].apply( instance, args );
94113 if ( methodValue !== instance && methodValue !== undefined ) {
95114 returnValue = methodValue;
96115 return false;
@@ -99,10 +118,7 @@
100119 this.each(function() {
101120 var instance = $.data( this, name );
102121 if ( instance ) {
103 - if ( options ) {
104 - instance.option( options );
105 - }
106 - instance._init();
 122+ instance.option( options || {} )._init();
107123 } else {
108124 $.data( this, name, new object( options, this ) );
109125 }
@@ -129,10 +145,11 @@
130146 _createWidget: function( options, element ) {
131147 // $.widget.bridge stores the plugin instance, but we do it anyway
132148 // so that it's stored even before the _create function runs
133 - this.element = $( element ).data( this.widgetName, this );
 149+ $.data( element, this.widgetName, this );
 150+ this.element = $( element );
134151 this.options = $.extend( true, {},
135152 this.options,
136 - $.metadata && $.metadata.get( element )[ this.widgetName ],
 153+ this._getCreateOptions(),
137154 options );
138155
139156 var self = this;
@@ -141,8 +158,12 @@
142159 });
143160
144161 this._create();
 162+ this._trigger( "create" );
145163 this._init();
146164 },
 165+ _getCreateOptions: function() {
 166+ return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
 167+ },
147168 _create: function() {},
148169 _init: function() {},
149170
@@ -163,12 +184,11 @@
164185 },
165186
166187 option: function( key, value ) {
167 - var options = key,
168 - self = this;
 188+ var options = key;
169189
170190 if ( arguments.length === 0 ) {
171191 // don't return a reference to the internal hash
172 - return $.extend( {}, self.options );
 192+ return $.extend( {}, this.options );
173193 }
174194
175195 if (typeof key === "string" ) {
@@ -179,11 +199,17 @@
180200 options[ key ] = value;
181201 }
182202
 203+ this._setOptions( options );
 204+
 205+ return this;
 206+ },
 207+ _setOptions: function( options ) {
 208+ var self = this;
183209 $.each( options, function( key, value ) {
184210 self._setOption( key, value );
185211 });
186212
187 - return self;
 213+ return this;
188214 },
189215 _setOption: function( key, value ) {
190216 this.options[ key ] = value;
Index: trunk/phase3/resources/jquery.ui/jquery.ui.core.js
@@ -1,83 +1,25 @@
22 /*!
3 - * jQuery UI 1.8.2
 3+ * jQuery UI 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI
1010 */
 11+(function( $, undefined ) {
1112
12 -(function($) {
13 -
1413 // prevent duplicate loading
1514 // this is only a problem because we proxy existing functions
1615 // and we don't want to double proxy them
1716 $.ui = $.ui || {};
18 -if ($.ui.version) {
 17+if ( $.ui.version ) {
1918 return;
2019 }
2120
22 -//Helper functions and ui object
23 -$.extend($.ui, {
24 - version: "1.8.2",
 21+$.extend( $.ui, {
 22+ version: "1.8.11",
2523
26 - // $.ui.plugin is deprecated. Use the proxy pattern instead.
27 - plugin: {
28 - add: function(module, option, set) {
29 - var proto = $.ui[module].prototype;
30 - for(var i in set) {
31 - proto.plugins[i] = proto.plugins[i] || [];
32 - proto.plugins[i].push([option, set[i]]);
33 - }
34 - },
35 - call: function(instance, name, args) {
36 - var set = instance.plugins[name];
37 - if(!set || !instance.element[0].parentNode) { return; }
38 -
39 - for (var i = 0; i < set.length; i++) {
40 - if (instance.options[set[i][0]]) {
41 - set[i][1].apply(instance.element, args);
42 - }
43 - }
44 - }
45 - },
46 -
47 - contains: function(a, b) {
48 - return document.compareDocumentPosition
49 - ? a.compareDocumentPosition(b) & 16
50 - : a !== b && a.contains(b);
51 - },
52 -
53 - hasScroll: function(el, a) {
54 -
55 - //If overflow is hidden, the element might have extra content, but the user wants to hide it
56 - if ($(el).css('overflow') == 'hidden') { return false; }
57 -
58 - var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
59 - has = false;
60 -
61 - if (el[scroll] > 0) { return true; }
62 -
63 - // TODO: determine which cases actually cause this to happen
64 - // if the element doesn't have the scroll set, see if it's possible to
65 - // set the scroll
66 - el[scroll] = 1;
67 - has = (el[scroll] > 0);
68 - el[scroll] = 0;
69 - return has;
70 - },
71 -
72 - isOverAxis: function(x, reference, size) {
73 - //Determines when x coordinate is over "b" element axis
74 - return (x > reference) && (x < (reference + size));
75 - },
76 -
77 - isOver: function(y, x, top, left, height, width) {
78 - //Determines when x, y coordinates is over "b" element
79 - return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
80 - },
81 -
8224 keyCode: {
8325 ALT: 18,
8426 BACKSPACE: 8,
@@ -114,36 +56,26 @@
11557 }
11658 });
11759
118 -//jQuery plugins
 60+// plugins
11961 $.fn.extend({
12062 _focus: $.fn.focus,
121 - focus: function(delay, fn) {
122 - return typeof delay === 'number'
123 - ? this.each(function() {
 63+ focus: function( delay, fn ) {
 64+ return typeof delay === "number" ?
 65+ this.each(function() {
12466 var elem = this;
12567 setTimeout(function() {
126 - $(elem).focus();
127 - (fn && fn.call(elem));
128 - }, delay);
129 - })
130 - : this._focus.apply(this, arguments);
 68+ $( elem ).focus();
 69+ if ( fn ) {
 70+ fn.call( elem );
 71+ }
 72+ }, delay );
 73+ }) :
 74+ this._focus.apply( this, arguments );
13175 },
132 -
133 - enableSelection: function() {
134 - return this
135 - .attr('unselectable', 'off')
136 - .css('MozUserSelect', '');
137 - },
13876
139 - disableSelection: function() {
140 - return this
141 - .attr('unselectable', 'on')
142 - .css('MozUserSelect', 'none');
143 - },
144 -
14577 scrollParent: function() {
14678 var scrollParent;
147 - if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
 79+ if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
14880 scrollParent = this.parents().filter(function() {
14981 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));
15082 }).eq(0);
@@ -156,26 +88,25 @@
15789 return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
15890 },
15991
160 - zIndex: function(zIndex) {
161 - if (zIndex !== undefined) {
162 - return this.css('zIndex', zIndex);
 92+ zIndex: function( zIndex ) {
 93+ if ( zIndex !== undefined ) {
 94+ return this.css( "zIndex", zIndex );
16395 }
164 -
165 - if (this.length) {
166 - var elem = $(this[0]), position, value;
167 - while (elem.length && elem[0] !== document) {
 96+
 97+ if ( this.length ) {
 98+ var elem = $( this[ 0 ] ), position, value;
 99+ while ( elem.length && elem[ 0 ] !== document ) {
168100 // Ignore z-index if position is set to a value where z-index is ignored by the browser
169101 // This makes behavior of this function consistent across browsers
170102 // WebKit always returns auto if the element is positioned
171 - position = elem.css('position');
172 - if (position == 'absolute' || position == 'relative' || position == 'fixed')
173 - {
 103+ position = elem.css( "position" );
 104+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
174105 // IE returns 0 when zIndex is not specified
175106 // other browsers return a string
176107 // we ignore the case of nested elements with an explicit value of 0
177108 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
178 - value = parseInt(elem.css('zIndex'));
179 - if (!isNaN(value) && value != 0) {
 109+ value = parseInt( elem.css( "zIndex" ), 10 );
 110+ if ( !isNaN( value ) && value !== 0 ) {
180111 return value;
181112 }
182113 }
@@ -184,33 +115,194 @@
185116 }
186117
187118 return 0;
 119+ },
 120+
 121+ disableSelection: function() {
 122+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
 123+ ".ui-disableSelection", function( event ) {
 124+ event.preventDefault();
 125+ });
 126+ },
 127+
 128+ enableSelection: function() {
 129+ return this.unbind( ".ui-disableSelection" );
188130 }
189131 });
190132
 133+$.each( [ "Width", "Height" ], function( i, name ) {
 134+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
 135+ type = name.toLowerCase(),
 136+ orig = {
 137+ innerWidth: $.fn.innerWidth,
 138+ innerHeight: $.fn.innerHeight,
 139+ outerWidth: $.fn.outerWidth,
 140+ outerHeight: $.fn.outerHeight
 141+ };
191142
192 -//Additional selectors
193 -$.extend($.expr[':'], {
194 - data: function(elem, i, match) {
195 - return !!$.data(elem, match[3]);
 143+ function reduce( elem, size, border, margin ) {
 144+ $.each( side, function() {
 145+ size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
 146+ if ( border ) {
 147+ size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
 148+ }
 149+ if ( margin ) {
 150+ size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
 151+ }
 152+ });
 153+ return size;
 154+ }
 155+
 156+ $.fn[ "inner" + name ] = function( size ) {
 157+ if ( size === undefined ) {
 158+ return orig[ "inner" + name ].call( this );
 159+ }
 160+
 161+ return this.each(function() {
 162+ $( this ).css( type, reduce( this, size ) + "px" );
 163+ });
 164+ };
 165+
 166+ $.fn[ "outer" + name] = function( size, margin ) {
 167+ if ( typeof size !== "number" ) {
 168+ return orig[ "outer" + name ].call( this, size );
 169+ }
 170+
 171+ return this.each(function() {
 172+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
 173+ });
 174+ };
 175+});
 176+
 177+// selectors
 178+function visible( element ) {
 179+ return !$( element ).parents().andSelf().filter(function() {
 180+ return $.curCSS( this, "visibility" ) === "hidden" ||
 181+ $.expr.filters.hidden( this );
 182+ }).length;
 183+}
 184+
 185+$.extend( $.expr[ ":" ], {
 186+ data: function( elem, i, match ) {
 187+ return !!$.data( elem, match[ 3 ] );
196188 },
197189
198 - focusable: function(element) {
 190+ focusable: function( element ) {
199191 var nodeName = element.nodeName.toLowerCase(),
200 - tabIndex = $.attr(element, 'tabindex');
201 - return (/input|select|textarea|button|object/.test(nodeName)
 192+ tabIndex = $.attr( element, "tabindex" );
 193+ if ( "area" === nodeName ) {
 194+ var map = element.parentNode,
 195+ mapName = map.name,
 196+ img;
 197+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
 198+ return false;
 199+ }
 200+ img = $( "img[usemap=#" + mapName + "]" )[0];
 201+ return !!img && visible( img );
 202+ }
 203+ return ( /input|select|textarea|button|object/.test( nodeName )
202204 ? !element.disabled
203 - : 'a' == nodeName || 'area' == nodeName
204 - ? element.href || !isNaN(tabIndex)
205 - : !isNaN(tabIndex))
 205+ : "a" == nodeName
 206+ ? element.href || !isNaN( tabIndex )
 207+ : !isNaN( tabIndex ))
206208 // the element and all of its ancestors must be visible
207 - // the browser may report that the area is hidden
208 - && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
 209+ && visible( element );
209210 },
210211
211 - tabbable: function(element) {
212 - var tabIndex = $.attr(element, 'tabindex');
213 - return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
 212+ tabbable: function( element ) {
 213+ var tabIndex = $.attr( element, "tabindex" );
 214+ return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
214215 }
215216 });
216217
217 -})(jQuery);
 218+// support
 219+$(function() {
 220+ var body = document.body,
 221+ div = body.appendChild( div = document.createElement( "div" ) );
 222+
 223+ $.extend( div.style, {
 224+ minHeight: "100px",
 225+ height: "auto",
 226+ padding: 0,
 227+ borderWidth: 0
 228+ });
 229+
 230+ $.support.minHeight = div.offsetHeight === 100;
 231+ $.support.selectstart = "onselectstart" in div;
 232+
 233+ // set display to none to avoid a layout bug in IE
 234+ // http://dev.jquery.com/ticket/4014
 235+ body.removeChild( div ).style.display = "none";
 236+});
 237+
 238+
 239+
 240+
 241+
 242+// deprecated
 243+$.extend( $.ui, {
 244+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
 245+ plugin: {
 246+ add: function( module, option, set ) {
 247+ var proto = $.ui[ module ].prototype;
 248+ for ( var i in set ) {
 249+ proto.plugins[ i ] = proto.plugins[ i ] || [];
 250+ proto.plugins[ i ].push( [ option, set[ i ] ] );
 251+ }
 252+ },
 253+ call: function( instance, name, args ) {
 254+ var set = instance.plugins[ name ];
 255+ if ( !set || !instance.element[ 0 ].parentNode ) {
 256+ return;
 257+ }
 258+
 259+ for ( var i = 0; i < set.length; i++ ) {
 260+ if ( instance.options[ set[ i ][ 0 ] ] ) {
 261+ set[ i ][ 1 ].apply( instance.element, args );
 262+ }
 263+ }
 264+ }
 265+ },
 266+
 267+ // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
 268+ contains: function( a, b ) {
 269+ return document.compareDocumentPosition ?
 270+ a.compareDocumentPosition( b ) & 16 :
 271+ a !== b && a.contains( b );
 272+ },
 273+
 274+ // only used by resizable
 275+ hasScroll: function( el, a ) {
 276+
 277+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
 278+ if ( $( el ).css( "overflow" ) === "hidden") {
 279+ return false;
 280+ }
 281+
 282+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
 283+ has = false;
 284+
 285+ if ( el[ scroll ] > 0 ) {
 286+ return true;
 287+ }
 288+
 289+ // TODO: determine which cases actually cause this to happen
 290+ // if the element doesn't have the scroll set, see if it's possible to
 291+ // set the scroll
 292+ el[ scroll ] = 1;
 293+ has = ( el[ scroll ] > 0 );
 294+ el[ scroll ] = 0;
 295+ return has;
 296+ },
 297+
 298+ // these are odd functions, fix the API or move into individual plugins
 299+ isOverAxis: function( x, reference, size ) {
 300+ //Determines when x coordinate is over "b" element axis
 301+ return ( x > reference ) && ( x < ( reference + size ) );
 302+ },
 303+ isOver: function( y, x, top, left, height, width ) {
 304+ //Determines when x, y coordinates is over "b" element
 305+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
 306+ }
 307+});
 308+
 309+})( jQuery );
Index: trunk/phase3/resources/jquery.ui/jquery.ui.mouse.js
@@ -1,16 +1,16 @@
22 /*!
3 - * jQuery UI Mouse 1.8.2
 3+ * jQuery UI Mouse 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Mouse
1010 *
1111 * Depends:
1212 * jquery.ui.widget.js
1313 */
14 -(function($) {
 14+(function( $, undefined ) {
1515
1616 $.widget("ui.mouse", {
1717 options: {
@@ -26,8 +26,8 @@
2727 return self._mouseDown(event);
2828 })
2929 .bind('click.'+this.widgetName, function(event) {
30 - if(self._preventClickEvent) {
31 - self._preventClickEvent = false;
 30+ if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
 31+ $.removeData(event.target, self.widgetName + '.preventClickEvent');
3232 event.stopImmediatePropagation();
3333 return false;
3434 }
@@ -75,6 +75,11 @@
7676 }
7777 }
7878
 79+ // Click event may never have fired (Gecko & Opera)
 80+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
 81+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
 82+ }
 83+
7984 // these delegates are required to keep context
8085 this._mouseMoveDelegate = function(event) {
8186 return self._mouseMove(event);
@@ -86,18 +91,14 @@
8792 .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
8893 .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
8994
90 - // preventDefault() is used to prevent the selection of text here -
91 - // however, in Safari, this causes select boxes not to be selectable
92 - // anymore, so this fix is needed
93 - ($.browser.safari || event.preventDefault());
94 -
 95+ event.preventDefault();
9596 event.originalEvent.mouseHandled = true;
9697 return true;
9798 },
9899
99100 _mouseMove: function(event) {
100101 // IE mouseup check - mouseup happened when mouse was out of window
101 - if ($.browser.msie && !event.button) {
 102+ if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
102103 return this._mouseUp(event);
103104 }
104105
@@ -122,7 +123,11 @@
123124
124125 if (this._mouseStarted) {
125126 this._mouseStarted = false;
126 - this._preventClickEvent = (event.target == this._mouseDownEvent.target);
 127+
 128+ if (event.target == this._mouseDownEvent.target) {
 129+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
 130+ }
 131+
127132 this._mouseStop(event);
128133 }
129134
Index: trunk/phase3/resources/jquery.ui/jquery.ui.tabs.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Tabs 1.8.2
 3+ * jQuery UI Tabs 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Tabs
1010 *
@@ -11,7 +11,7 @@
1212 * jquery.ui.core.js
1313 * jquery.ui.widget.js
1414 */
15 -(function($) {
 15+(function( $, undefined ) {
1616
1717 var tabId = 0,
1818 listId = 0;
@@ -24,7 +24,7 @@
2525 return ++listId;
2626 }
2727
28 -$.widget("ui.tabs", {
 28+$.widget( "ui.tabs", {
2929 options: {
3030 add: null,
3131 ajaxOptions: null,
@@ -34,619 +34,650 @@
3535 disable: null,
3636 disabled: [],
3737 enable: null,
38 - event: 'click',
 38+ event: "click",
3939 fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
40 - idPrefix: 'ui-tabs-',
 40+ idPrefix: "ui-tabs-",
4141 load: null,
42 - panelTemplate: '<div></div>',
 42+ panelTemplate: "<div></div>",
4343 remove: null,
4444 select: null,
4545 show: null,
46 - spinner: '<em>Loading&#8230;</em>',
47 - tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
 46+ spinner: "<em>Loading&#8230;</em>",
 47+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
4848 },
 49+
4950 _create: function() {
50 - this._tabify(true);
 51+ this._tabify( true );
5152 },
5253
53 - _setOption: function(key, value) {
54 - if (key == 'selected') {
55 - if (this.options.collapsible && value == this.options.selected) {
 54+ _setOption: function( key, value ) {
 55+ if ( key == "selected" ) {
 56+ if (this.options.collapsible && value == this.options.selected ) {
5657 return;
5758 }
58 - this.select(value);
59 - }
60 - else {
61 - this.options[key] = value;
 59+ this.select( value );
 60+ } else {
 61+ this.options[ key ] = value;
6262 this._tabify();
6363 }
6464 },
6565
66 - _tabId: function(a) {
67 - return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
 66+ _tabId: function( a ) {
 67+ return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
6868 this.options.idPrefix + getNextTabId();
6969 },
7070
71 - _sanitizeSelector: function(hash) {
72 - return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
 71+ _sanitizeSelector: function( hash ) {
 72+ // we need this because an id may contain a ":"
 73+ return hash.replace( /:/g, "\\:" );
7374 },
7475
7576 _cookie: function() {
76 - var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + getNextListId());
77 - return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
 77+ var cookie = this.cookie ||
 78+ ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
 79+ return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
7880 },
7981
80 - _ui: function(tab, panel) {
 82+ _ui: function( tab, panel ) {
8183 return {
8284 tab: tab,
8385 panel: panel,
84 - index: this.anchors.index(tab)
 86+ index: this.anchors.index( tab )
8587 };
8688 },
8789
8890 _cleanup: function() {
8991 // restore all former loading tabs labels
90 - this.lis.filter('.ui-state-processing').removeClass('ui-state-processing')
91 - .find('span:data(label.tabs)')
 92+ this.lis.filter( ".ui-state-processing" )
 93+ .removeClass( "ui-state-processing" )
 94+ .find( "span:data(label.tabs)" )
9295 .each(function() {
93 - var el = $(this);
94 - el.html(el.data('label.tabs')).removeData('label.tabs');
 96+ var el = $( this );
 97+ el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
9598 });
9699 },
97100
98 - _tabify: function(init) {
 101+ _tabify: function( init ) {
 102+ var self = this,
 103+ o = this.options,
 104+ fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
99105
100 - this.list = this.element.find('ol,ul').eq(0);
101 - this.lis = $('li:has(a[href])', this.list);
102 - this.anchors = this.lis.map(function() { return $('a', this)[0]; });
103 - this.panels = $([]);
 106+ this.list = this.element.find( "ol,ul" ).eq( 0 );
 107+ this.lis = $( " > li:has(a[href])", this.list );
 108+ this.anchors = this.lis.map(function() {
 109+ return $( "a", this )[ 0 ];
 110+ });
 111+ this.panels = $( [] );
104112
105 - var self = this, o = this.options;
106 -
107 - var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
108 - this.anchors.each(function(i, a) {
109 - var href = $(a).attr('href');
110 -
 113+ this.anchors.each(function( i, a ) {
 114+ var href = $( a ).attr( "href" );
111115 // For dynamically created HTML that contains a hash as href IE < 8 expands
112116 // such href to the full page url with hash and then misinterprets tab as ajax.
113117 // Same consideration applies for an added tab with a fragment identifier
114118 // since a[href=#fragment-identifier] does unexpectedly not match.
115119 // Thus normalize href attribute...
116 - var hrefBase = href.split('#')[0], baseEl;
117 - if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
118 - (baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
 120+ var hrefBase = href.split( "#" )[ 0 ],
 121+ baseEl;
 122+ if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
 123+ ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
119124 href = a.hash;
120125 a.href = href;
121126 }
122127
123128 // inline tab
124 - if (fragmentId.test(href)) {
125 - self.panels = self.panels.add(self._sanitizeSelector(href));
126 - }
127 -
 129+ if ( fragmentId.test( href ) ) {
 130+ self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
128131 // remote tab
129 - else if (href != '#') { // prevent loading the page itself if href is just "#"
130 - $.data(a, 'href.tabs', href); // required for restore on destroy
 132+ // prevent loading the page itself if href is just "#"
 133+ } else if ( href && href !== "#" ) {
 134+ // required for restore on destroy
 135+ $.data( a, "href.tabs", href );
131136
132137 // TODO until #3808 is fixed strip fragment identifier from url
133138 // (IE fails to load from such url)
134 - $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data
 139+ $.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
135140
136 - var id = self._tabId(a);
137 - a.href = '#' + id;
138 - var $panel = $('#' + id);
139 - if (!$panel.length) {
140 - $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom')
141 - .insertAfter(self.panels[i - 1] || self.list);
142 - $panel.data('destroy.tabs', true);
 141+ var id = self._tabId( a );
 142+ a.href = "#" + id;
 143+ var $panel = self.element.find( "#" + id );
 144+ if ( !$panel.length ) {
 145+ $panel = $( o.panelTemplate )
 146+ .attr( "id", id )
 147+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
 148+ .insertAfter( self.panels[ i - 1 ] || self.list );
 149+ $panel.data( "destroy.tabs", true );
143150 }
144 - self.panels = self.panels.add($panel);
145 - }
146 -
 151+ self.panels = self.panels.add( $panel );
147152 // invalid tab href
148 - else {
149 - o.disabled.push(i);
 153+ } else {
 154+ o.disabled.push( i );
150155 }
151156 });
152157
153158 // initialization from scratch
154 - if (init) {
155 -
 159+ if ( init ) {
156160 // attach necessary classes for styling
157 - this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
158 - this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
159 - this.lis.addClass('ui-state-default ui-corner-top');
160 - this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');
 161+ this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
 162+ this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
 163+ this.lis.addClass( "ui-state-default ui-corner-top" );
 164+ this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
161165
162166 // Selected tab
163167 // use "selected" option or try to retrieve:
164168 // 1. from fragment identifier in url
165169 // 2. from cookie
166170 // 3. from selected class attribute on <li>
167 - if (o.selected === undefined) {
168 - if (location.hash) {
169 - this.anchors.each(function(i, a) {
170 - if (a.hash == location.hash) {
 171+ if ( o.selected === undefined ) {
 172+ if ( location.hash ) {
 173+ this.anchors.each(function( i, a ) {
 174+ if ( a.hash == location.hash ) {
171175 o.selected = i;
172 - return false; // break
 176+ return false;
173177 }
174178 });
175179 }
176 - if (typeof o.selected != 'number' && o.cookie) {
177 - o.selected = parseInt(self._cookie(), 10);
 180+ if ( typeof o.selected !== "number" && o.cookie ) {
 181+ o.selected = parseInt( self._cookie(), 10 );
178182 }
179 - if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) {
180 - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
 183+ if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
 184+ o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
181185 }
182 - o.selected = o.selected || (this.lis.length ? 0 : -1);
183 - }
184 - else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release
 186+ o.selected = o.selected || ( this.lis.length ? 0 : -1 );
 187+ } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
185188 o.selected = -1;
186189 }
187190
188191 // sanity check - default to first tab...
189 - o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0;
 192+ o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
 193+ ? o.selected
 194+ : 0;
190195
191196 // Take disabling tabs via class attribute from HTML
192197 // into account and update option properly.
193198 // A selected tab cannot become disabled.
194 - o.disabled = $.unique(o.disabled.concat(
195 - $.map(this.lis.filter('.ui-state-disabled'),
196 - function(n, i) { return self.lis.index(n); } )
197 - )).sort();
 199+ o.disabled = $.unique( o.disabled.concat(
 200+ $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
 201+ return self.lis.index( n );
 202+ })
 203+ ) ).sort();
198204
199 - if ($.inArray(o.selected, o.disabled) != -1) {
200 - o.disabled.splice($.inArray(o.selected, o.disabled), 1);
 205+ if ( $.inArray( o.selected, o.disabled ) != -1 ) {
 206+ o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
201207 }
202208
203209 // highlight selected tab
204 - this.panels.addClass('ui-tabs-hide');
205 - this.lis.removeClass('ui-tabs-selected ui-state-active');
206 - if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list
207 - this.panels.eq(o.selected).removeClass('ui-tabs-hide');
208 - this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');
 210+ this.panels.addClass( "ui-tabs-hide" );
 211+ this.lis.removeClass( "ui-tabs-selected ui-state-active" );
 212+ // check for length avoids error when initializing empty list
 213+ if ( o.selected >= 0 && this.anchors.length ) {
 214+ self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
 215+ this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
209216
210217 // seems to be expected behavior that the show callback is fired
211 - self.element.queue("tabs", function() {
212 - self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected]));
 218+ self.element.queue( "tabs", function() {
 219+ self._trigger( "show", null,
 220+ self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );
213221 });
214 -
215 - this.load(o.selected);
 222+
 223+ this.load( o.selected );
216224 }
217225
218226 // clean up to avoid memory leaks in certain versions of IE 6
219 - $(window).bind('unload', function() {
220 - self.lis.add(self.anchors).unbind('.tabs');
 227+ // TODO: namespace this event
 228+ $( window ).bind( "unload", function() {
 229+ self.lis.add( self.anchors ).unbind( ".tabs" );
221230 self.lis = self.anchors = self.panels = null;
222231 });
223 -
224 - }
225232 // update selected after add/remove
226 - else {
227 - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
 233+ } else {
 234+ o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
228235 }
229236
230237 // update collapsible
231 - this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible');
 238+ // TODO: use .toggleClass()
 239+ this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
232240
233241 // set or update cookie after init and add/remove respectively
234 - if (o.cookie) {
235 - this._cookie(o.selected, o.cookie);
 242+ if ( o.cookie ) {
 243+ this._cookie( o.selected, o.cookie );
236244 }
237245
238246 // disable tabs
239 - for (var i = 0, li; (li = this.lis[i]); i++) {
240 - $(li)[$.inArray(i, o.disabled) != -1 &&
241 - !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');
 247+ for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
 248+ $( li )[ $.inArray( i, o.disabled ) != -1 &&
 249+ // TODO: use .toggleClass()
 250+ !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
242251 }
243252
244253 // reset cache if switching from cached to not cached
245 - if (o.cache === false) {
246 - this.anchors.removeData('cache.tabs');
 254+ if ( o.cache === false ) {
 255+ this.anchors.removeData( "cache.tabs" );
247256 }
248257
249258 // remove all handlers before, tabify may run on existing tabs after add or option change
250 - this.lis.add(this.anchors).unbind('.tabs');
 259+ this.lis.add( this.anchors ).unbind( ".tabs" );
251260
252 - if (o.event != 'mouseover') {
253 - var addState = function(state, el) {
254 - if (el.is(':not(.ui-state-disabled)')) {
255 - el.addClass('ui-state-' + state);
 261+ if ( o.event !== "mouseover" ) {
 262+ var addState = function( state, el ) {
 263+ if ( el.is( ":not(.ui-state-disabled)" ) ) {
 264+ el.addClass( "ui-state-" + state );
256265 }
257266 };
258 - var removeState = function(state, el) {
259 - el.removeClass('ui-state-' + state);
 267+ var removeState = function( state, el ) {
 268+ el.removeClass( "ui-state-" + state );
260269 };
261 - this.lis.bind('mouseover.tabs', function() {
262 - addState('hover', $(this));
 270+ this.lis.bind( "mouseover.tabs" , function() {
 271+ addState( "hover", $( this ) );
263272 });
264 - this.lis.bind('mouseout.tabs', function() {
265 - removeState('hover', $(this));
 273+ this.lis.bind( "mouseout.tabs", function() {
 274+ removeState( "hover", $( this ) );
266275 });
267 - this.anchors.bind('focus.tabs', function() {
268 - addState('focus', $(this).closest('li'));
 276+ this.anchors.bind( "focus.tabs", function() {
 277+ addState( "focus", $( this ).closest( "li" ) );
269278 });
270 - this.anchors.bind('blur.tabs', function() {
271 - removeState('focus', $(this).closest('li'));
 279+ this.anchors.bind( "blur.tabs", function() {
 280+ removeState( "focus", $( this ).closest( "li" ) );
272281 });
273282 }
274283
275284 // set up animations
276285 var hideFx, showFx;
277 - if (o.fx) {
278 - if ($.isArray(o.fx)) {
279 - hideFx = o.fx[0];
280 - showFx = o.fx[1];
281 - }
282 - else {
 286+ if ( o.fx ) {
 287+ if ( $.isArray( o.fx ) ) {
 288+ hideFx = o.fx[ 0 ];
 289+ showFx = o.fx[ 1 ];
 290+ } else {
283291 hideFx = showFx = o.fx;
284292 }
285293 }
286294
287295 // Reset certain styles left over from animation
288296 // and prevent IE's ClearType bug...
289 - function resetStyle($el, fx) {
290 - $el.css({ display: '' });
291 - if (!$.support.opacity && fx.opacity) {
292 - $el[0].style.removeAttribute('filter');
 297+ function resetStyle( $el, fx ) {
 298+ $el.css( "display", "" );
 299+ if ( !$.support.opacity && fx.opacity ) {
 300+ $el[ 0 ].style.removeAttribute( "filter" );
293301 }
294302 }
295303
296304 // Show a tab...
297 - var showTab = showFx ?
298 - function(clicked, $show) {
299 - $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
300 - $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way
301 - .animate(showFx, showFx.duration || 'normal', function() {
302 - resetStyle($show, showFx);
303 - self._trigger('show', null, self._ui(clicked, $show[0]));
 305+ var showTab = showFx
 306+ ? function( clicked, $show ) {
 307+ $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
 308+ $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
 309+ .animate( showFx, showFx.duration || "normal", function() {
 310+ resetStyle( $show, showFx );
 311+ self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
304312 });
305 - } :
306 - function(clicked, $show) {
307 - $(clicked).closest('li').addClass('ui-tabs-selected ui-state-active');
308 - $show.removeClass('ui-tabs-hide');
309 - self._trigger('show', null, self._ui(clicked, $show[0]));
 313+ }
 314+ : function( clicked, $show ) {
 315+ $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
 316+ $show.removeClass( "ui-tabs-hide" );
 317+ self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
310318 };
311319
312320 // Hide a tab, $show is optional...
313 - var hideTab = hideFx ?
314 - function(clicked, $hide) {
315 - $hide.animate(hideFx, hideFx.duration || 'normal', function() {
316 - self.lis.removeClass('ui-tabs-selected ui-state-active');
317 - $hide.addClass('ui-tabs-hide');
318 - resetStyle($hide, hideFx);
319 - self.element.dequeue("tabs");
 321+ var hideTab = hideFx
 322+ ? function( clicked, $hide ) {
 323+ $hide.animate( hideFx, hideFx.duration || "normal", function() {
 324+ self.lis.removeClass( "ui-tabs-selected ui-state-active" );
 325+ $hide.addClass( "ui-tabs-hide" );
 326+ resetStyle( $hide, hideFx );
 327+ self.element.dequeue( "tabs" );
320328 });
321 - } :
322 - function(clicked, $hide, $show) {
323 - self.lis.removeClass('ui-tabs-selected ui-state-active');
324 - $hide.addClass('ui-tabs-hide');
325 - self.element.dequeue("tabs");
 329+ }
 330+ : function( clicked, $hide, $show ) {
 331+ self.lis.removeClass( "ui-tabs-selected ui-state-active" );
 332+ $hide.addClass( "ui-tabs-hide" );
 333+ self.element.dequeue( "tabs" );
326334 };
327335
328336 // attach tab event handler, unbind to avoid duplicates from former tabifying...
329 - this.anchors.bind(o.event + '.tabs', function() {
330 - var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'),
331 - $show = $(self._sanitizeSelector(this.hash));
 337+ this.anchors.bind( o.event + ".tabs", function() {
 338+ var el = this,
 339+ $li = $(el).closest( "li" ),
 340+ $hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
 341+ $show = self.element.find( self._sanitizeSelector( el.hash ) );
332342
333343 // If tab is already selected and not collapsible or tab disabled or
334344 // or is already loading or click callback returns false stop here.
335345 // Check if click handler returns false last so that it is not executed
336346 // for a disabled or loading tab!
337 - if (($li.hasClass('ui-tabs-selected') && !o.collapsible) ||
338 - $li.hasClass('ui-state-disabled') ||
339 - $li.hasClass('ui-state-processing') ||
340 - self._trigger('select', null, self._ui(this, $show[0])) === false) {
 347+ if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
 348+ $li.hasClass( "ui-state-disabled" ) ||
 349+ $li.hasClass( "ui-state-processing" ) ||
 350+ self.panels.filter( ":animated" ).length ||
 351+ self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
341352 this.blur();
342353 return false;
343354 }
344355
345 - o.selected = self.anchors.index(this);
 356+ o.selected = self.anchors.index( this );
346357
347358 self.abort();
348359
349360 // if tab may be closed
350 - if (o.collapsible) {
351 - if ($li.hasClass('ui-tabs-selected')) {
 361+ if ( o.collapsible ) {
 362+ if ( $li.hasClass( "ui-tabs-selected" ) ) {
352363 o.selected = -1;
353364
354 - if (o.cookie) {
355 - self._cookie(o.selected, o.cookie);
 365+ if ( o.cookie ) {
 366+ self._cookie( o.selected, o.cookie );
356367 }
357368
358 - self.element.queue("tabs", function() {
359 - hideTab(el, $hide);
360 - }).dequeue("tabs");
361 -
 369+ self.element.queue( "tabs", function() {
 370+ hideTab( el, $hide );
 371+ }).dequeue( "tabs" );
 372+
362373 this.blur();
363374 return false;
364 - }
365 - else if (!$hide.length) {
366 - if (o.cookie) {
367 - self._cookie(o.selected, o.cookie);
 375+ } else if ( !$hide.length ) {
 376+ if ( o.cookie ) {
 377+ self._cookie( o.selected, o.cookie );
368378 }
369 -
370 - self.element.queue("tabs", function() {
371 - showTab(el, $show);
 379+
 380+ self.element.queue( "tabs", function() {
 381+ showTab( el, $show );
372382 });
373383
374 - self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
375 -
 384+ // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
 385+ self.load( self.anchors.index( this ) );
 386+
376387 this.blur();
377388 return false;
378389 }
379390 }
380391
381 - if (o.cookie) {
382 - self._cookie(o.selected, o.cookie);
 392+ if ( o.cookie ) {
 393+ self._cookie( o.selected, o.cookie );
383394 }
384395
385396 // show new tab
386 - if ($show.length) {
387 - if ($hide.length) {
388 - self.element.queue("tabs", function() {
389 - hideTab(el, $hide);
 397+ if ( $show.length ) {
 398+ if ( $hide.length ) {
 399+ self.element.queue( "tabs", function() {
 400+ hideTab( el, $hide );
390401 });
391402 }
392 - self.element.queue("tabs", function() {
393 - showTab(el, $show);
 403+ self.element.queue( "tabs", function() {
 404+ showTab( el, $show );
394405 });
395 -
396 - self.load(self.anchors.index(this));
 406+
 407+ self.load( self.anchors.index( this ) );
 408+ } else {
 409+ throw "jQuery UI Tabs: Mismatching fragment identifier.";
397410 }
398 - else {
399 - throw 'jQuery UI Tabs: Mismatching fragment identifier.';
400 - }
401411
402412 // Prevent IE from keeping other link focussed when using the back button
403413 // and remove dotted border from clicked link. This is controlled via CSS
404414 // in modern browsers; blur() removes focus from address bar in Firefox
405415 // which can become a usability and annoying problem with tabs('rotate').
406 - if ($.browser.msie) {
 416+ if ( $.browser.msie ) {
407417 this.blur();
408418 }
409 -
410419 });
411420
412421 // disable click in any case
413 - this.anchors.bind('click.tabs', function(){return false;});
 422+ this.anchors.bind( "click.tabs", function(){
 423+ return false;
 424+ });
 425+ },
414426
 427+ _getIndex: function( index ) {
 428+ // meta-function to give users option to provide a href string instead of a numerical index.
 429+ // also sanitizes numerical indexes to valid values.
 430+ if ( typeof index == "string" ) {
 431+ index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
 432+ }
 433+
 434+ return index;
415435 },
416436
417437 destroy: function() {
418438 var o = this.options;
419439
420440 this.abort();
421 -
422 - this.element.unbind('.tabs')
423 - .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
424 - .removeData('tabs');
425441
426 - this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
 442+ this.element
 443+ .unbind( ".tabs" )
 444+ .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
 445+ .removeData( "tabs" );
427446
 447+ this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
 448+
428449 this.anchors.each(function() {
429 - var href = $.data(this, 'href.tabs');
430 - if (href) {
 450+ var href = $.data( this, "href.tabs" );
 451+ if ( href ) {
431452 this.href = href;
432453 }
433 - var $this = $(this).unbind('.tabs');
434 - $.each(['href', 'load', 'cache'], function(i, prefix) {
435 - $this.removeData(prefix + '.tabs');
 454+ var $this = $( this ).unbind( ".tabs" );
 455+ $.each( [ "href", "load", "cache" ], function( i, prefix ) {
 456+ $this.removeData( prefix + ".tabs" );
436457 });
437458 });
438459
439 - this.lis.unbind('.tabs').add(this.panels).each(function() {
440 - if ($.data(this, 'destroy.tabs')) {
441 - $(this).remove();
 460+ this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
 461+ if ( $.data( this, "destroy.tabs" ) ) {
 462+ $( this ).remove();
 463+ } else {
 464+ $( this ).removeClass([
 465+ "ui-state-default",
 466+ "ui-corner-top",
 467+ "ui-tabs-selected",
 468+ "ui-state-active",
 469+ "ui-state-hover",
 470+ "ui-state-focus",
 471+ "ui-state-disabled",
 472+ "ui-tabs-panel",
 473+ "ui-widget-content",
 474+ "ui-corner-bottom",
 475+ "ui-tabs-hide"
 476+ ].join( " " ) );
442477 }
443 - else {
444 - $(this).removeClass([
445 - 'ui-state-default',
446 - 'ui-corner-top',
447 - 'ui-tabs-selected',
448 - 'ui-state-active',
449 - 'ui-state-hover',
450 - 'ui-state-focus',
451 - 'ui-state-disabled',
452 - 'ui-tabs-panel',
453 - 'ui-widget-content',
454 - 'ui-corner-bottom',
455 - 'ui-tabs-hide'
456 - ].join(' '));
457 - }
458478 });
459479
460 - if (o.cookie) {
461 - this._cookie(null, o.cookie);
 480+ if ( o.cookie ) {
 481+ this._cookie( null, o.cookie );
462482 }
463483
464484 return this;
465485 },
466486
467 - add: function(url, label, index) {
468 - if (index === undefined) {
469 - index = this.anchors.length; // append by default
 487+ add: function( url, label, index ) {
 488+ if ( index === undefined ) {
 489+ index = this.anchors.length;
470490 }
471491
472 - var self = this, o = this.options,
473 - $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)),
474 - id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]);
 492+ var self = this,
 493+ o = this.options,
 494+ $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
 495+ id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
475496
476 - $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true);
 497+ $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
477498
478499 // try to find an existing element before creating a new one
479 - var $panel = $('#' + id);
480 - if (!$panel.length) {
481 - $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true);
 500+ var $panel = self.element.find( "#" + id );
 501+ if ( !$panel.length ) {
 502+ $panel = $( o.panelTemplate )
 503+ .attr( "id", id )
 504+ .data( "destroy.tabs", true );
482505 }
483 - $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');
 506+ $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
484507
485 - if (index >= this.lis.length) {
486 - $li.appendTo(this.list);
487 - $panel.appendTo(this.list[0].parentNode);
 508+ if ( index >= this.lis.length ) {
 509+ $li.appendTo( this.list );
 510+ $panel.appendTo( this.list[ 0 ].parentNode );
 511+ } else {
 512+ $li.insertBefore( this.lis[ index ] );
 513+ $panel.insertBefore( this.panels[ index ] );
488514 }
489 - else {
490 - $li.insertBefore(this.lis[index]);
491 - $panel.insertBefore(this.panels[index]);
492 - }
493515
494 - o.disabled = $.map(o.disabled,
495 - function(n, i) { return n >= index ? ++n : n; });
 516+ o.disabled = $.map( o.disabled, function( n, i ) {
 517+ return n >= index ? ++n : n;
 518+ });
496519
497520 this._tabify();
498521
499 - if (this.anchors.length == 1) { // after tabify
 522+ if ( this.anchors.length == 1 ) {
500523 o.selected = 0;
501 - $li.addClass('ui-tabs-selected ui-state-active');
502 - $panel.removeClass('ui-tabs-hide');
503 - this.element.queue("tabs", function() {
504 - self._trigger('show', null, self._ui(self.anchors[0], self.panels[0]));
 524+ $li.addClass( "ui-tabs-selected ui-state-active" );
 525+ $panel.removeClass( "ui-tabs-hide" );
 526+ this.element.queue( "tabs", function() {
 527+ self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
505528 });
506 -
507 - this.load(0);
 529+
 530+ this.load( 0 );
508531 }
509532
510 - // callback
511 - this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
 533+ this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
512534 return this;
513535 },
514536
515 - remove: function(index) {
516 - var o = this.options, $li = this.lis.eq(index).remove(),
517 - $panel = this.panels.eq(index).remove();
 537+ remove: function( index ) {
 538+ index = this._getIndex( index );
 539+ var o = this.options,
 540+ $li = this.lis.eq( index ).remove(),
 541+ $panel = this.panels.eq( index ).remove();
518542
519543 // If selected tab was removed focus tab to the right or
520544 // in case the last tab was removed the tab to the left.
521 - if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) {
522 - this.select(index + (index + 1 < this.anchors.length ? 1 : -1));
 545+ if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
 546+ this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
523547 }
524548
525 - o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
526 - function(n, i) { return n >= index ? --n : n; });
 549+ o.disabled = $.map(
 550+ $.grep( o.disabled, function(n, i) {
 551+ return n != index;
 552+ }),
 553+ function( n, i ) {
 554+ return n >= index ? --n : n;
 555+ });
527556
528557 this._tabify();
529558
530 - // callback
531 - this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
 559+ this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
532560 return this;
533561 },
534562
535 - enable: function(index) {
 563+ enable: function( index ) {
 564+ index = this._getIndex( index );
536565 var o = this.options;
537 - if ($.inArray(index, o.disabled) == -1) {
 566+ if ( $.inArray( index, o.disabled ) == -1 ) {
538567 return;
539568 }
540569
541 - this.lis.eq(index).removeClass('ui-state-disabled');
542 - o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
 570+ this.lis.eq( index ).removeClass( "ui-state-disabled" );
 571+ o.disabled = $.grep( o.disabled, function( n, i ) {
 572+ return n != index;
 573+ });
543574
544 - // callback
545 - this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
 575+ this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
546576 return this;
547577 },
548578
549 - disable: function(index) {
 579+ disable: function( index ) {
 580+ index = this._getIndex( index );
550581 var self = this, o = this.options;
551 - if (index != o.selected) { // cannot disable already selected tab
552 - this.lis.eq(index).addClass('ui-state-disabled');
 582+ // cannot disable already selected tab
 583+ if ( index != o.selected ) {
 584+ this.lis.eq( index ).addClass( "ui-state-disabled" );
553585
554 - o.disabled.push(index);
 586+ o.disabled.push( index );
555587 o.disabled.sort();
556588
557 - // callback
558 - this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
 589+ this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
559590 }
560591
561592 return this;
562593 },
563594
564 - select: function(index) {
565 - if (typeof index == 'string') {
566 - index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
 595+ select: function( index ) {
 596+ index = this._getIndex( index );
 597+ if ( index == -1 ) {
 598+ if ( this.options.collapsible && this.options.selected != -1 ) {
 599+ index = this.options.selected;
 600+ } else {
 601+ return this;
 602+ }
567603 }
568 - else if (index === null) { // usage of null is deprecated, TODO remove in next release
569 - index = -1;
570 - }
571 - if (index == -1 && this.options.collapsible) {
572 - index = this.options.selected;
573 - }
574 -
575 - this.anchors.eq(index).trigger(this.options.event + '.tabs');
 604+ this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
576605 return this;
577606 },
578607
579 - load: function(index) {
580 - var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs');
 608+ load: function( index ) {
 609+ index = this._getIndex( index );
 610+ var self = this,
 611+ o = this.options,
 612+ a = this.anchors.eq( index )[ 0 ],
 613+ url = $.data( a, "load.tabs" );
581614
582615 this.abort();
583616
584617 // not remote or from cache
585 - if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) {
586 - this.element.dequeue("tabs");
 618+ if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
 619+ this.element.dequeue( "tabs" );
587620 return;
588621 }
589622
590623 // load remote from here on
591 - this.lis.eq(index).addClass('ui-state-processing');
 624+ this.lis.eq( index ).addClass( "ui-state-processing" );
592625
593 - if (o.spinner) {
594 - var span = $('span', a);
595 - span.data('label.tabs', span.html()).html(o.spinner);
 626+ if ( o.spinner ) {
 627+ var span = $( "span", a );
 628+ span.data( "label.tabs", span.html() ).html( o.spinner );
596629 }
597630
598 - this.xhr = $.ajax($.extend({}, o.ajaxOptions, {
 631+ this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
599632 url: url,
600 - success: function(r, s) {
601 - $(self._sanitizeSelector(a.hash)).html(r);
 633+ success: function( r, s ) {
 634+ self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
602635
603636 // take care of tab labels
604637 self._cleanup();
605638
606 - if (o.cache) {
607 - $.data(a, 'cache.tabs', true); // if loaded once do not load them again
 639+ if ( o.cache ) {
 640+ $.data( a, "cache.tabs", true );
608641 }
609642
610 - // callbacks
611 - self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
 643+ self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
612644 try {
613 - o.ajaxOptions.success(r, s);
 645+ o.ajaxOptions.success( r, s );
614646 }
615 - catch (e) {}
 647+ catch ( e ) {}
616648 },
617 - error: function(xhr, s, e) {
 649+ error: function( xhr, s, e ) {
618650 // take care of tab labels
619651 self._cleanup();
620652
621 - // callbacks
622 - self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
 653+ self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
623654 try {
624655 // Passing index avoid a race condition when this method is
625656 // called after the user has selected another tab.
626657 // Pass the anchor that initiated this request allows
627658 // loadError to manipulate the tab content panel via $(a.hash)
628 - o.ajaxOptions.error(xhr, s, index, a);
 659+ o.ajaxOptions.error( xhr, s, index, a );
629660 }
630 - catch (e) {}
 661+ catch ( e ) {}
631662 }
632 - }));
 663+ } ) );
633664
634665 // last, so that load event is fired before show...
635 - self.element.dequeue("tabs");
 666+ self.element.dequeue( "tabs" );
636667
637668 return this;
638669 },
639670
640671 abort: function() {
641672 // stop possibly running animations
642 - this.element.queue([]);
643 - this.panels.stop(false, true);
 673+ this.element.queue( [] );
 674+ this.panels.stop( false, true );
644675
645676 // "tabs" queue must not contain more than two elements,
646677 // which are the callbacks for the latest clicked tab...
647 - this.element.queue("tabs", this.element.queue("tabs").splice(-2, 2));
 678+ this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
648679
649680 // terminate pending requests from other tabs
650 - if (this.xhr) {
 681+ if ( this.xhr ) {
651682 this.xhr.abort();
652683 delete this.xhr;
653684 }
@@ -656,19 +687,18 @@
657688 return this;
658689 },
659690
660 - url: function(index, url) {
661 - this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
 691+ url: function( index, url ) {
 692+ this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
662693 return this;
663694 },
664695
665696 length: function() {
666697 return this.anchors.length;
667698 }
668 -
669699 });
670700
671 -$.extend($.ui.tabs, {
672 - version: '1.8.2'
 701+$.extend( $.ui.tabs, {
 702+ version: "1.8.11"
673703 });
674704
675705 /*
@@ -678,46 +708,45 @@
679709 /*
680710 * Rotate
681711 */
682 -$.extend($.ui.tabs.prototype, {
 712+$.extend( $.ui.tabs.prototype, {
683713 rotation: null,
684 - rotate: function(ms, continuing) {
 714+ rotate: function( ms, continuing ) {
 715+ var self = this,
 716+ o = this.options;
685717
686 - var self = this, o = this.options;
687 -
688 - var rotate = self._rotate || (self._rotate = function(e) {
689 - clearTimeout(self.rotation);
 718+ var rotate = self._rotate || ( self._rotate = function( e ) {
 719+ clearTimeout( self.rotation );
690720 self.rotation = setTimeout(function() {
691721 var t = o.selected;
692722 self.select( ++t < self.anchors.length ? t : 0 );
693 - }, ms);
 723+ }, ms );
694724
695 - if (e) {
 725+ if ( e ) {
696726 e.stopPropagation();
697727 }
698728 });
699 -
700 - var stop = self._unrotate || (self._unrotate = !continuing ?
701 - function(e) {
 729+
 730+ var stop = self._unrotate || ( self._unrotate = !continuing
 731+ ? function(e) {
702732 if (e.clientX) { // in case of a true click
703733 self.rotate(null);
704734 }
705 - } :
706 - function(e) {
 735+ }
 736+ : function( e ) {
707737 t = o.selected;
708738 rotate();
709739 });
710740
711741 // start rotation
712 - if (ms) {
713 - this.element.bind('tabsshow', rotate);
714 - this.anchors.bind(o.event + '.tabs', stop);
 742+ if ( ms ) {
 743+ this.element.bind( "tabsshow", rotate );
 744+ this.anchors.bind( o.event + ".tabs", stop );
715745 rotate();
716 - }
717746 // stop rotation
718 - else {
719 - clearTimeout(self.rotation);
720 - this.element.unbind('tabsshow', rotate);
721 - this.anchors.unbind(o.event + '.tabs', stop);
 747+ } else {
 748+ clearTimeout( self.rotation );
 749+ this.element.unbind( "tabsshow", rotate );
 750+ this.anchors.unbind( o.event + ".tabs", stop );
722751 delete this._rotate;
723752 delete this._unrotate;
724753 }
@@ -726,4 +755,4 @@
727756 }
728757 });
729758
730 -})(jQuery);
 759+})( jQuery );
Index: trunk/phase3/resources/jquery.ui/jquery.ui.progressbar.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Progressbar 1.8.2
 3+ * jQuery UI Progressbar 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Progressbar
1010 *
@@ -11,25 +11,30 @@
1212 * jquery.ui.core.js
1313 * jquery.ui.widget.js
1414 */
15 -(function( $ ) {
 15+(function( $, undefined ) {
1616
1717 $.widget( "ui.progressbar", {
1818 options: {
19 - value: 0
 19+ value: 0,
 20+ max: 100
2021 },
 22+
 23+ min: 0,
 24+
2125 _create: function() {
2226 this.element
2327 .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
2428 .attr({
2529 role: "progressbar",
26 - "aria-valuemin": this._valueMin(),
27 - "aria-valuemax": this._valueMax(),
 30+ "aria-valuemin": this.min,
 31+ "aria-valuemax": this.options.max,
2832 "aria-valuenow": this._value()
2933 });
3034
3135 this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
3236 .appendTo( this.element );
3337
 38+ this.oldValue = this._value();
3439 this._refreshValue();
3540 },
3641
@@ -56,12 +61,12 @@
5762 },
5863
5964 _setOption: function( key, value ) {
60 - switch ( key ) {
61 - case "value":
62 - this.options.value = value;
63 - this._refreshValue();
64 - this._trigger( "change" );
65 - break;
 65+ if ( key === "value" ) {
 66+ this.options.value = value;
 67+ this._refreshValue();
 68+ if ( this._value() === this.options.max ) {
 69+ this._trigger( "complete" );
 70+ }
6671 }
6772
6873 $.Widget.prototype._setOption.apply( this, arguments );
@@ -73,35 +78,31 @@
7479 if ( typeof val !== "number" ) {
7580 val = 0;
7681 }
77 - if ( val < this._valueMin() ) {
78 - val = this._valueMin();
79 - }
80 - if ( val > this._valueMax() ) {
81 - val = this._valueMax();
82 - }
83 -
84 - return val;
 82+ return Math.min( this.options.max, Math.max( this.min, val ) );
8583 },
8684
87 - _valueMin: function() {
88 - return 0;
 85+ _percentage: function() {
 86+ return 100 * this._value() / this.options.max;
8987 },
9088
91 - _valueMax: function() {
92 - return 100;
93 - },
94 -
9589 _refreshValue: function() {
9690 var value = this.value();
 91+ var percentage = this._percentage();
 92+
 93+ if ( this.oldValue !== value ) {
 94+ this.oldValue = value;
 95+ this._trigger( "change" );
 96+ }
 97+
9798 this.valueDiv
98 - [ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
99 - .width( value + "%" );
 99+ .toggleClass( "ui-corner-right", value === this.options.max )
 100+ .width( percentage.toFixed(0) + "%" );
100101 this.element.attr( "aria-valuenow", value );
101102 }
102103 });
103104
104105 $.extend( $.ui.progressbar, {
105 - version: "1.8.2"
 106+ version: "1.8.11"
106107 });
107108
108109 })( jQuery );
Index: trunk/phase3/resources/jquery.ui/jquery.ui.dialog.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Dialog 1.8.2
 3+ * jQuery UI Dialog 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Dialog
1010 *
@@ -16,13 +16,28 @@
1717 * jquery.ui.position.js
1818 * jquery.ui.resizable.js
1919 */
20 -(function($) {
 20+(function( $, undefined ) {
2121
2222 var uiDialogClasses =
23 - 'ui-dialog ' +
24 - 'ui-widget ' +
25 - 'ui-widget-content ' +
26 - 'ui-corner-all ';
 23+ 'ui-dialog ' +
 24+ 'ui-widget ' +
 25+ 'ui-widget-content ' +
 26+ 'ui-corner-all ',
 27+ sizeRelatedOptions = {
 28+ buttons: true,
 29+ height: true,
 30+ maxHeight: true,
 31+ maxWidth: true,
 32+ minHeight: true,
 33+ minWidth: true,
 34+ width: true
 35+ },
 36+ resizableRelatedOptions = {
 37+ maxHeight: true,
 38+ maxWidth: true,
 39+ minHeight: true,
 40+ minWidth: true
 41+ };
2742
2843 $.widget("ui.dialog", {
2944 options: {
@@ -39,7 +54,18 @@
4055 minHeight: 150,
4156 minWidth: 150,
4257 modal: false,
43 - position: 'center',
 58+ position: {
 59+ my: 'center',
 60+ at: 'center',
 61+ collision: 'fit',
 62+ // ensure that the titlebar is never outside the document
 63+ using: function(pos) {
 64+ var topOffset = $(this).css(pos).offset().top;
 65+ if (topOffset < 0) {
 66+ $(this).css('top', pos.top - topOffset);
 67+ }
 68+ }
 69+ },
4470 resizable: true,
4571 show: null,
4672 stack: true,
@@ -47,13 +73,19 @@
4874 width: 300,
4975 zIndex: 1000
5076 },
 77+
5178 _create: function() {
5279 this.originalTitle = this.element.attr('title');
 80+ // #5742 - .attr() might return a DOMElement
 81+ if ( typeof this.originalTitle !== "string" ) {
 82+ this.originalTitle = "";
 83+ }
5384
 85+ this.options.title = this.options.title || this.originalTitle;
5486 var self = this,
5587 options = self.options,
5688
57 - title = options.title || self.originalTitle || '&#160;',
 89+ title = options.title || '&#160;',
5890 titleId = $.ui.dialog.getTitleId(self.element),
5991
6092 uiDialog = (self.uiDialog = $('<div></div>'))
@@ -161,6 +193,7 @@
162194 uiDialog.bgiframe();
163195 }
164196 },
 197+
165198 _init: function() {
166199 if ( this.options.autoOpen ) {
167200 this.open();
@@ -187,14 +220,14 @@
188221
189222 return self;
190223 },
191 -
 224+
192225 widget: function() {
193226 return this.uiDialog;
194227 },
195228
196229 close: function(event) {
197230 var self = this,
198 - maxZ;
 231+ maxZ, thisZ;
199232
200233 if (false === self._trigger('beforeClose', event)) {
201234 return;
@@ -223,7 +256,10 @@
224257 maxZ = 0;
225258 $('.ui-dialog').each(function() {
226259 if (this !== self.uiDialog[0]) {
227 - maxZ = Math.max(maxZ, $(this).css('z-index'));
 260+ thisZ = $(this).css('z-index');
 261+ if(!isNaN(thisZ)) {
 262+ maxZ = Math.max(maxZ, thisZ);
 263+ }
228264 }
229265 });
230266 $.ui.dialog.maxZ = maxZ;
@@ -242,12 +278,12 @@
243279 var self = this,
244280 options = self.options,
245281 saveScroll;
246 -
 282+
247283 if ((options.modal && !force) ||
248284 (!options.stack && !options.modal)) {
249285 return self._trigger('focus', event);
250286 }
251 -
 287+
252288 if (options.zIndex > $.ui.dialog.maxZ) {
253289 $.ui.dialog.maxZ = options.zIndex;
254290 }
@@ -275,9 +311,6 @@
276312 uiDialog = self.uiDialog;
277313
278314 self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
279 - if (uiDialog.next().length) {
280 - uiDialog.appendTo('body');
281 - }
282315 self._size();
283316 self._position(options.position);
284317 uiDialog.show(options.show);
@@ -289,11 +322,11 @@
290323 if (event.keyCode !== $.ui.keyCode.TAB) {
291324 return;
292325 }
293 -
 326+
294327 var tabbables = $(':tabbable', this),
295328 first = tabbables.filter(':first'),
296329 last = tabbables.filter(':last');
297 -
 330+
298331 if (event.target === last[0] && !event.shiftKey) {
299332 first.focus(1);
300333 return false;
@@ -306,15 +339,12 @@
307340
308341 // set focus to the first tabbable element in the content area or the first button
309342 // if there are no tabbable elements, set focus on the dialog itself
310 - $([])
311 - .add(uiDialog.find('.ui-dialog-content :tabbable:first'))
312 - .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
313 - .add(uiDialog)
314 - .filter(':first')
315 - .focus();
 343+ $(self.element.find(':tabbable').get().concat(
 344+ uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
 345+ uiDialog.get()))).eq(0).focus();
316346
 347+ self._isOpen = true;
317348 self._trigger('open');
318 - self._isOpen = true;
319349
320350 return self;
321351 },
@@ -327,7 +357,10 @@
328358 'ui-dialog-buttonpane ' +
329359 'ui-widget-content ' +
330360 'ui-helper-clearfix'
331 - );
 361+ ),
 362+ uiButtonSet = $( "<div></div>" )
 363+ .addClass( "ui-dialog-buttonset" )
 364+ .appendTo( uiDialogButtonPane );
332365
333366 // if we already have a button pane, remove it
334367 self.uiDialog.find('.ui-dialog-buttonpane').remove();
@@ -338,11 +371,17 @@
339372 });
340373 }
341374 if (hasButtons) {
342 - $.each(buttons, function(name, fn) {
 375+ $.each(buttons, function(name, props) {
 376+ props = $.isFunction( props ) ?
 377+ { click: props, text: name } :
 378+ props;
343379 var button = $('<button type="button"></button>')
344 - .text(name)
345 - .click(function() { fn.apply(self.element[0], arguments); })
346 - .appendTo(uiDialogButtonPane);
 380+ .attr( props, true )
 381+ .unbind('click')
 382+ .click(function() {
 383+ props.click.apply(self.element[0], arguments);
 384+ })
 385+ .appendTo(uiButtonSet);
347386 if ($.fn.button) {
348387 button.button();
349388 }
@@ -450,40 +489,34 @@
451490 offset = [0, 0],
452491 isVisible;
453492
454 - position = position || $.ui.dialog.prototype.options.position;
 493+ if (position) {
 494+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
 495+ // if (typeof position == 'string' || $.isArray(position)) {
 496+ // myAt = $.isArray(position) ? position : position.split(' ');
455497
456 - // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
457 -// if (typeof position == 'string' || $.isArray(position)) {
458 -// myAt = $.isArray(position) ? position : position.split(' ');
 498+ if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
 499+ myAt = position.split ? position.split(' ') : [position[0], position[1]];
 500+ if (myAt.length === 1) {
 501+ myAt[1] = myAt[0];
 502+ }
459503
460 - if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
461 - myAt = position.split ? position.split(' ') : [position[0], position[1]];
462 - if (myAt.length === 1) {
463 - myAt[1] = myAt[0];
464 - }
 504+ $.each(['left', 'top'], function(i, offsetPosition) {
 505+ if (+myAt[i] === myAt[i]) {
 506+ offset[i] = myAt[i];
 507+ myAt[i] = offsetPosition;
 508+ }
 509+ });
465510
466 - $.each(['left', 'top'], function(i, offsetPosition) {
467 - if (+myAt[i] === myAt[i]) {
468 - offset[i] = myAt[i];
469 - myAt[i] = offsetPosition;
470 - }
471 - });
472 - } else if (typeof position === 'object') {
473 - if ('left' in position) {
474 - myAt[0] = 'left';
475 - offset[0] = position.left;
476 - } else if ('right' in position) {
477 - myAt[0] = 'right';
478 - offset[0] = -position.right;
479 - }
 511+ position = {
 512+ my: myAt.join(" "),
 513+ at: myAt.join(" "),
 514+ offset: offset.join(" ")
 515+ };
 516+ }
480517
481 - if ('top' in position) {
482 - myAt[1] = 'top';
483 - offset[1] = position.top;
484 - } else if ('bottom' in position) {
485 - myAt[1] = 'bottom';
486 - offset[1] = -position.bottom;
487 - }
 518+ position = $.extend({}, $.ui.dialog.prototype.options.position, position);
 519+ } else {
 520+ position = $.ui.dialog.prototype.options.position;
488521 }
489522
490523 // need to show the dialog to get the actual offset in the position plugin
@@ -494,31 +527,40 @@
495528 this.uiDialog
496529 // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
497530 .css({ top: 0, left: 0 })
498 - .position({
499 - my: myAt.join(' '),
500 - at: myAt.join(' '),
501 - offset: offset.join(' '),
502 - of: window,
503 - collision: 'fit',
504 - // ensure that the titlebar is never outside the document
505 - using: function(pos) {
506 - var topOffset = $(this).css(pos).offset().top;
507 - if (topOffset < 0) {
508 - $(this).css('top', pos.top - topOffset);
509 - }
510 - }
511 - });
 531+ .position($.extend({ of: window }, position));
512532 if (!isVisible) {
513533 this.uiDialog.hide();
514534 }
515535 },
516536
 537+ _setOptions: function( options ) {
 538+ var self = this,
 539+ resizableOptions = {},
 540+ resize = false;
 541+
 542+ $.each( options, function( key, value ) {
 543+ self._setOption( key, value );
 544+
 545+ if ( key in sizeRelatedOptions ) {
 546+ resize = true;
 547+ }
 548+ if ( key in resizableRelatedOptions ) {
 549+ resizableOptions[ key ] = value;
 550+ }
 551+ });
 552+
 553+ if ( resize ) {
 554+ this._size();
 555+ }
 556+ if ( this.uiDialog.is( ":data(resizable)" ) ) {
 557+ this.uiDialog.resizable( "option", resizableOptions );
 558+ }
 559+ },
 560+
517561 _setOption: function(key, value){
518562 var self = this,
519 - uiDialog = self.uiDialog,
520 - isResizable = uiDialog.is(':data(resizable)'),
521 - resize = false;
522 -
 563+ uiDialog = self.uiDialog;
 564+
523565 switch (key) {
524566 //handling of deprecated beforeclose (vs beforeClose) option
525567 //Ticket #4669 http://dev.jqueryui.com/ticket/4669
@@ -530,7 +572,7 @@
531573 self._createButtons(value);
532574 break;
533575 case "closeText":
534 - // convert whatever was passed in to a string, for text() to not throw up
 576+ // ensure that we always pass a string
535577 self.uiDialogTitlebarCloseText.text("" + value);
536578 break;
537579 case "dialogClass":
@@ -546,44 +588,21 @@
547589 }
548590 break;
549591 case "draggable":
550 - if (value) {
 592+ var isDraggable = uiDialog.is( ":data(draggable)" );
 593+ if ( isDraggable && !value ) {
 594+ uiDialog.draggable( "destroy" );
 595+ }
 596+
 597+ if ( !isDraggable && value ) {
551598 self._makeDraggable();
552 - } else {
553 - uiDialog.draggable('destroy');
554599 }
555600 break;
556 - case "height":
557 - resize = true;
558 - break;
559 - case "maxHeight":
560 - if (isResizable) {
561 - uiDialog.resizable('option', 'maxHeight', value);
562 - }
563 - resize = true;
564 - break;
565 - case "maxWidth":
566 - if (isResizable) {
567 - uiDialog.resizable('option', 'maxWidth', value);
568 - }
569 - resize = true;
570 - break;
571 - case "minHeight":
572 - if (isResizable) {
573 - uiDialog.resizable('option', 'minHeight', value);
574 - }
575 - resize = true;
576 - break;
577 - case "minWidth":
578 - if (isResizable) {
579 - uiDialog.resizable('option', 'minWidth', value);
580 - }
581 - resize = true;
582 - break;
583601 case "position":
584602 self._position(value);
585603 break;
586604 case "resizable":
587605 // currently resizable, becoming non-resizable
 606+ var isResizable = uiDialog.is( ":data(resizable)" );
588607 if (isResizable && !value) {
589608 uiDialog.resizable('destroy');
590609 }
@@ -602,15 +621,9 @@
603622 // convert whatever was passed in o a string, for html() to not throw up
604623 $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
605624 break;
606 - case "width":
607 - resize = true;
608 - break;
609625 }
610626
611627 $.Widget.prototype._setOption.apply(self, arguments);
612 - if (resize) {
613 - self._size();
614 - }
615628 },
616629
617630 _size: function() {
@@ -618,16 +631,21 @@
619632 * divs will both have width and height set, so we need to reset them
620633 */
621634 var options = this.options,
622 - nonContentHeight;
 635+ nonContentHeight,
 636+ minContentHeight,
 637+ isVisible = this.uiDialog.is( ":visible" );
623638
624639 // reset content sizing
625 - // hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
626 - this.element.css({
 640+ this.element.show().css({
627641 width: 'auto',
628642 minHeight: 0,
629643 height: 0
630644 });
631645
 646+ if (options.minWidth > options.width) {
 647+ options.width = options.minWidth;
 648+ }
 649+
632650 // reset wrapper sizing
633651 // determine the height of all the non-content elements
634652 nonContentHeight = this.uiDialog.css({
@@ -635,17 +653,27 @@
636654 width: options.width
637655 })
638656 .height();
 657+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
 658+
 659+ if ( options.height === "auto" ) {
 660+ // only needed for IE6 support
 661+ if ( $.support.minHeight ) {
 662+ this.element.css({
 663+ minHeight: minContentHeight,
 664+ height: "auto"
 665+ });
 666+ } else {
 667+ this.uiDialog.show();
 668+ var autoHeight = this.element.css( "height", "auto" ).height();
 669+ if ( !isVisible ) {
 670+ this.uiDialog.hide();
 671+ }
 672+ this.element.height( Math.max( autoHeight, minContentHeight ) );
 673+ }
 674+ } else {
 675+ this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
 676+ }
639677
640 - this.element
641 - .css(options.height === 'auto' ? {
642 - minHeight: Math.max(options.minHeight - nonContentHeight, 0),
643 - height: 'auto'
644 - } : {
645 - minHeight: 0,
646 - height: Math.max(options.height - nonContentHeight, 0)
647 - })
648 - .show();
649 -
650678 if (this.uiDialog.is(':data(resizable)')) {
651679 this.uiDialog.resizable('option', 'minHeight', this._minHeight());
652680 }
@@ -653,7 +681,7 @@
654682 });
655683
656684 $.extend($.ui.dialog, {
657 - version: "1.8.2",
 685+ version: "1.8.11",
658686
659687 uuid: 0,
660688 maxZ: 0,
@@ -689,7 +717,10 @@
690718 if ($.ui.dialog.overlay.instances.length) {
691719 $(document).bind($.ui.dialog.overlay.events, function(event) {
692720 // stop events if the z-index of the target is < the z-index of the overlay
693 - return ($(event.target).zIndex() >= $.ui.dialog.overlay.maxZ);
 721+ // we cannot return true when we don't want to cancel the event (#3523)
 722+ if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
 723+ return false;
 724+ }
694725 });
695726 }
696727 }, 1);
@@ -724,7 +755,10 @@
725756 },
726757
727758 destroy: function($el) {
728 - this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
 759+ var indexOf = $.inArray($el, this.instances);
 760+ if (indexOf != -1){
 761+ this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
 762+ }
729763
730764 if (this.instances.length === 0) {
731765 $([document, window]).unbind('.dialog-overlay');
Index: trunk/phase3/resources/jquery.ui/jquery.ui.accordion.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Accordion 1.8.2
 3+ * jQuery UI Accordion 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Accordion
1010 *
@@ -11,12 +11,12 @@
1212 * jquery.ui.core.js
1313 * jquery.ui.widget.js
1414 */
15 -(function($) {
 15+(function( $, undefined ) {
1616
17 -$.widget("ui.accordion", {
 17+$.widget( "ui.accordion", {
1818 options: {
1919 active: 0,
20 - animated: 'slide',
 20+ animated: "slide",
2121 autoHeight: true,
2222 clearStyle: false,
2323 collapsible: false,
@@ -29,322 +29,398 @@
3030 },
3131 navigation: false,
3232 navigationFilter: function() {
33 - return this.href.toLowerCase() == location.href.toLowerCase();
 33+ return this.href.toLowerCase() === location.href.toLowerCase();
3434 }
3535 },
 36+
3637 _create: function() {
 38+ var self = this,
 39+ options = self.options;
3740
38 - var o = this.options, self = this;
39 - this.running = 0;
 41+ self.running = 0;
4042
41 - this.element.addClass("ui-accordion ui-widget ui-helper-reset");
42 -
43 - // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
44 - this.element.children("li").addClass("ui-accordion-li-fix");
 43+ self.element
 44+ .addClass( "ui-accordion ui-widget ui-helper-reset" )
 45+ // in lack of child-selectors in CSS
 46+ // we need to mark top-LIs in a UL-accordion for some IE-fix
 47+ .children( "li" )
 48+ .addClass( "ui-accordion-li-fix" );
4549
46 - this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
47 - .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); })
48 - .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); })
49 - .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); })
50 - .bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); });
 50+ self.headers = self.element.find( options.header )
 51+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
 52+ .bind( "mouseenter.accordion", function() {
 53+ if ( options.disabled ) {
 54+ return;
 55+ }
 56+ $( this ).addClass( "ui-state-hover" );
 57+ })
 58+ .bind( "mouseleave.accordion", function() {
 59+ if ( options.disabled ) {
 60+ return;
 61+ }
 62+ $( this ).removeClass( "ui-state-hover" );
 63+ })
 64+ .bind( "focus.accordion", function() {
 65+ if ( options.disabled ) {
 66+ return;
 67+ }
 68+ $( this ).addClass( "ui-state-focus" );
 69+ })
 70+ .bind( "blur.accordion", function() {
 71+ if ( options.disabled ) {
 72+ return;
 73+ }
 74+ $( this ).removeClass( "ui-state-focus" );
 75+ });
5176
52 - this.headers
53 - .next()
54 - .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
 77+ self.headers.next()
 78+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
5579
56 - if ( o.navigation ) {
57 - var current = this.element.find("a").filter(o.navigationFilter);
 80+ if ( options.navigation ) {
 81+ var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
5882 if ( current.length ) {
59 - var header = current.closest(".ui-accordion-header");
 83+ var header = current.closest( ".ui-accordion-header" );
6084 if ( header.length ) {
6185 // anchor within header
62 - this.active = header;
 86+ self.active = header;
6387 } else {
6488 // anchor within content
65 - this.active = current.closest(".ui-accordion-content").prev();
 89+ self.active = current.closest( ".ui-accordion-content" ).prev();
6690 }
6791 }
6892 }
6993
70 - this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
71 - this.active.next().addClass('ui-accordion-content-active');
 94+ self.active = self._findActive( self.active || options.active )
 95+ .addClass( "ui-state-default ui-state-active" )
 96+ .toggleClass( "ui-corner-all" )
 97+ .toggleClass( "ui-corner-top" );
 98+ self.active.next().addClass( "ui-accordion-content-active" );
7299
73 - //Append icon elements
74 - this._createIcons();
 100+ self._createIcons();
 101+ self.resize();
 102+
 103+ // ARIA
 104+ self.element.attr( "role", "tablist" );
75105
76 - this.resize();
77 -
78 - //ARIA
79 - this.element.attr('role','tablist');
80 -
81 - this.headers
82 - .attr('role','tab')
83 - .bind('keydown', function(event) { return self._keydown(event); })
 106+ self.headers
 107+ .attr( "role", "tab" )
 108+ .bind( "keydown.accordion", function( event ) {
 109+ return self._keydown( event );
 110+ })
84111 .next()
85 - .attr('role','tabpanel');
 112+ .attr( "role", "tabpanel" );
86113
87 - this.headers
88 - .not(this.active || "")
89 - .attr('aria-expanded','false')
90 - .attr("tabIndex", "-1")
 114+ self.headers
 115+ .not( self.active || "" )
 116+ .attr({
 117+ "aria-expanded": "false",
 118+ "aria-selected": "false",
 119+ tabIndex: -1
 120+ })
91121 .next()
92 - .hide();
 122+ .hide();
93123
94124 // make sure at least one header is in the tab order
95 - if (!this.active.length) {
96 - this.headers.eq(0).attr('tabIndex','0');
 125+ if ( !self.active.length ) {
 126+ self.headers.eq( 0 ).attr( "tabIndex", 0 );
97127 } else {
98 - this.active
99 - .attr('aria-expanded','true')
100 - .attr('tabIndex', '0');
 128+ self.active
 129+ .attr({
 130+ "aria-expanded": "true",
 131+ "aria-selected": "true",
 132+ tabIndex: 0
 133+ });
101134 }
102135
103 - // only need links in taborder for Safari
104 - if (!$.browser.safari)
105 - this.headers.find('a').attr('tabIndex','-1');
 136+ // only need links in tab order for Safari
 137+ if ( !$.browser.safari ) {
 138+ self.headers.find( "a" ).attr( "tabIndex", -1 );
 139+ }
106140
107 - if (o.event) {
108 - this.headers.bind((o.event) + ".accordion", function(event) {
109 - self._clickHandler.call(self, event, this);
 141+ if ( options.event ) {
 142+ self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
 143+ self._clickHandler.call( self, event, this );
110144 event.preventDefault();
111145 });
112146 }
 147+ },
113148
114 - },
115 -
116149 _createIcons: function() {
117 - var o = this.options;
118 - if (o.icons) {
119 - $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
120 - this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
121 - this.element.addClass("ui-accordion-icons");
 150+ var options = this.options;
 151+ if ( options.icons ) {
 152+ $( "<span></span>" )
 153+ .addClass( "ui-icon " + options.icons.header )
 154+ .prependTo( this.headers );
 155+ this.active.children( ".ui-icon" )
 156+ .toggleClass(options.icons.header)
 157+ .toggleClass(options.icons.headerSelected);
 158+ this.element.addClass( "ui-accordion-icons" );
122159 }
123160 },
124 -
 161+
125162 _destroyIcons: function() {
126 - this.headers.children(".ui-icon").remove();
127 - this.element.removeClass("ui-accordion-icons");
 163+ this.headers.children( ".ui-icon" ).remove();
 164+ this.element.removeClass( "ui-accordion-icons" );
128165 },
129166
130167 destroy: function() {
131 - var o = this.options;
 168+ var options = this.options;
132169
133170 this.element
134 - .removeClass("ui-accordion ui-widget ui-helper-reset")
135 - .removeAttr("role")
136 - .unbind('.accordion')
137 - .removeData('accordion');
 171+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
 172+ .removeAttr( "role" );
138173
139174 this.headers
140 - .unbind(".accordion")
141 - .removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
142 - .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");
 175+ .unbind( ".accordion" )
 176+ .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" )
 177+ .removeAttr( "role" )
 178+ .removeAttr( "aria-expanded" )
 179+ .removeAttr( "aria-selected" )
 180+ .removeAttr( "tabIndex" );
143181
144 - this.headers.find("a").removeAttr("tabIndex");
 182+ this.headers.find( "a" ).removeAttr( "tabIndex" );
145183 this._destroyIcons();
146 - 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");
147 - if (o.autoHeight || o.fillHeight) {
148 - contents.css("height", "");
 184+ var contents = this.headers.next()
 185+ .css( "display", "" )
 186+ .removeAttr( "role" )
 187+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
 188+ if ( options.autoHeight || options.fillHeight ) {
 189+ contents.css( "height", "" );
149190 }
150191
151 - return this;
 192+ return $.Widget.prototype.destroy.call( this );
152193 },
153 -
154 - _setOption: function(key, value) {
155 - $.Widget.prototype._setOption.apply(this, arguments);
 194+
 195+ _setOption: function( key, value ) {
 196+ $.Widget.prototype._setOption.apply( this, arguments );
156197
157 - if (key == "active") {
158 - this.activate(value);
 198+ if ( key == "active" ) {
 199+ this.activate( value );
159200 }
160 - if (key == "icons") {
 201+ if ( key == "icons" ) {
161202 this._destroyIcons();
162 - if (value) {
 203+ if ( value ) {
163204 this._createIcons();
164205 }
165206 }
166 -
 207+ // #5332 - opacity doesn't cascade to positioned elements in IE
 208+ // so we need to add the disabled class to the headers and panels
 209+ if ( key == "disabled" ) {
 210+ this.headers.add(this.headers.next())
 211+ [ value ? "addClass" : "removeClass" ](
 212+ "ui-accordion-disabled ui-state-disabled" );
 213+ }
167214 },
168215
169 - _keydown: function(event) {
170 -
171 - var o = this.options, keyCode = $.ui.keyCode;
172 -
173 - if (o.disabled || event.altKey || event.ctrlKey)
 216+ _keydown: function( event ) {
 217+ if ( this.options.disabled || event.altKey || event.ctrlKey ) {
174218 return;
 219+ }
175220
176 - var length = this.headers.length;
177 - var currentIndex = this.headers.index(event.target);
178 - var toFocus = false;
 221+ var keyCode = $.ui.keyCode,
 222+ length = this.headers.length,
 223+ currentIndex = this.headers.index( event.target ),
 224+ toFocus = false;
179225
180 - switch(event.keyCode) {
 226+ switch ( event.keyCode ) {
181227 case keyCode.RIGHT:
182228 case keyCode.DOWN:
183 - toFocus = this.headers[(currentIndex + 1) % length];
 229+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
184230 break;
185231 case keyCode.LEFT:
186232 case keyCode.UP:
187 - toFocus = this.headers[(currentIndex - 1 + length) % length];
 233+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
188234 break;
189235 case keyCode.SPACE:
190236 case keyCode.ENTER:
191 - this._clickHandler({ target: event.target }, event.target);
 237+ this._clickHandler( { target: event.target }, event.target );
192238 event.preventDefault();
193239 }
194240
195 - if (toFocus) {
196 - $(event.target).attr('tabIndex','-1');
197 - $(toFocus).attr('tabIndex','0');
 241+ if ( toFocus ) {
 242+ $( event.target ).attr( "tabIndex", -1 );
 243+ $( toFocus ).attr( "tabIndex", 0 );
198244 toFocus.focus();
199245 return false;
200246 }
201247
202248 return true;
203 -
204249 },
205250
206251 resize: function() {
 252+ var options = this.options,
 253+ maxHeight;
207254
208 - var o = this.options, maxHeight;
 255+ if ( options.fillSpace ) {
 256+ if ( $.browser.msie ) {
 257+ var defOverflow = this.element.parent().css( "overflow" );
 258+ this.element.parent().css( "overflow", "hidden");
 259+ }
 260+ maxHeight = this.element.parent().height();
 261+ if ($.browser.msie) {
 262+ this.element.parent().css( "overflow", defOverflow );
 263+ }
209264
210 - if (o.fillSpace) {
211 -
212 - if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
213 - maxHeight = this.element.parent().height();
214 - if($.browser.msie) { this.element.parent().css('overflow', defOverflow); }
215 -
216265 this.headers.each(function() {
217 - maxHeight -= $(this).outerHeight(true);
 266+ maxHeight -= $( this ).outerHeight( true );
218267 });
219268
220 - this.headers.next().each(function() {
221 - $(this).height(Math.max(0, maxHeight - $(this).innerHeight() + $(this).height()));
222 - }).css('overflow', 'auto');
223 -
224 - } else if ( o.autoHeight ) {
 269+ this.headers.next()
 270+ .each(function() {
 271+ $( this ).height( Math.max( 0, maxHeight -
 272+ $( this ).innerHeight() + $( this ).height() ) );
 273+ })
 274+ .css( "overflow", "auto" );
 275+ } else if ( options.autoHeight ) {
225276 maxHeight = 0;
226 - this.headers.next().each(function() {
227 - maxHeight = Math.max(maxHeight, $(this).height());
228 - }).height(maxHeight);
 277+ this.headers.next()
 278+ .each(function() {
 279+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
 280+ })
 281+ .height( maxHeight );
229282 }
230283
231284 return this;
232285 },
233286
234 - activate: function(index) {
 287+ activate: function( index ) {
235288 // TODO this gets called on init, changing the option without an explicit call for that
236289 this.options.active = index;
237290 // call clickHandler with custom event
238 - var active = this._findActive(index)[0];
239 - this._clickHandler({ target: active }, active);
 291+ var active = this._findActive( index )[ 0 ];
 292+ this._clickHandler( { target: active }, active );
240293
241294 return this;
242295 },
243296
244 - _findActive: function(selector) {
 297+ _findActive: function( selector ) {
245298 return selector
246 - ? typeof selector == "number"
247 - ? this.headers.filter(":eq(" + selector + ")")
248 - : this.headers.not(this.headers.not(selector))
 299+ ? typeof selector === "number"
 300+ ? this.headers.filter( ":eq(" + selector + ")" )
 301+ : this.headers.not( this.headers.not( selector ) )
249302 : selector === false
250 - ? $([])
251 - : this.headers.filter(":eq(0)");
 303+ ? $( [] )
 304+ : this.headers.filter( ":eq(0)" );
252305 },
253306
254 - // TODO isn't event.target enough? why the seperate target argument?
255 - _clickHandler: function(event, target) {
256 -
257 - var o = this.options;
258 - if (o.disabled)
 307+ // TODO isn't event.target enough? why the separate target argument?
 308+ _clickHandler: function( event, target ) {
 309+ var options = this.options;
 310+ if ( options.disabled ) {
259311 return;
 312+ }
260313
261314 // called only when using activate(false) to close all parts programmatically
262 - if (!event.target) {
263 - if (!o.collapsible)
 315+ if ( !event.target ) {
 316+ if ( !options.collapsible ) {
264317 return;
265 - this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
266 - .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
267 - this.active.next().addClass('ui-accordion-content-active');
 318+ }
 319+ this.active
 320+ .removeClass( "ui-state-active ui-corner-top" )
 321+ .addClass( "ui-state-default ui-corner-all" )
 322+ .children( ".ui-icon" )
 323+ .removeClass( options.icons.headerSelected )
 324+ .addClass( options.icons.header );
 325+ this.active.next().addClass( "ui-accordion-content-active" );
268326 var toHide = this.active.next(),
269327 data = {
270 - options: o,
271 - newHeader: $([]),
272 - oldHeader: o.active,
273 - newContent: $([]),
 328+ options: options,
 329+ newHeader: $( [] ),
 330+ oldHeader: options.active,
 331+ newContent: $( [] ),
274332 oldContent: toHide
275333 },
276 - toShow = (this.active = $([]));
277 - this._toggle(toShow, toHide, data);
 334+ toShow = ( this.active = $( [] ) );
 335+ this._toggle( toShow, toHide, data );
278336 return;
279337 }
280338
281339 // get the click target
282 - var clicked = $(event.currentTarget || target);
283 - var clickedIsActive = clicked[0] == this.active[0];
284 -
 340+ var clicked = $( event.currentTarget || target ),
 341+ clickedIsActive = clicked[0] === this.active[0];
 342+
285343 // TODO the option is changed, is that correct?
286344 // TODO if it is correct, shouldn't that happen after determining that the click is valid?
287 - o.active = o.collapsible && clickedIsActive ? false : $('.ui-accordion-header', this.element).index(clicked);
 345+ options.active = options.collapsible && clickedIsActive ?
 346+ false :
 347+ this.headers.index( clicked );
288348
289349 // if animations are still active, or the active header is the target, ignore click
290 - if (this.running || (!o.collapsible && clickedIsActive)) {
 350+ if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
291351 return;
292352 }
293353
294 - // switch classes
295 - this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
296 - .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
297 - if (!clickedIsActive) {
298 - clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
299 - .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
300 - clicked.next().addClass('ui-accordion-content-active');
301 - }
302 -
303354 // find elements to show and hide
304 - var toShow = clicked.next(),
 355+ var active = this.active,
 356+ toShow = clicked.next(),
305357 toHide = this.active.next(),
306358 data = {
307 - options: o,
308 - newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
 359+ options: options,
 360+ newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
309361 oldHeader: this.active,
310 - newContent: clickedIsActive && o.collapsible ? $([]) : toShow,
 362+ newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
311363 oldContent: toHide
312364 },
313365 down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
314366
 367+ // when the call to ._toggle() comes after the class changes
 368+ // it causes a very odd bug in IE 8 (see #6720)
315369 this.active = clickedIsActive ? $([]) : clicked;
316 - this._toggle(toShow, toHide, data, clickedIsActive, down);
 370+ this._toggle( toShow, toHide, data, clickedIsActive, down );
317371
 372+ // switch classes
 373+ active
 374+ .removeClass( "ui-state-active ui-corner-top" )
 375+ .addClass( "ui-state-default ui-corner-all" )
 376+ .children( ".ui-icon" )
 377+ .removeClass( options.icons.headerSelected )
 378+ .addClass( options.icons.header );
 379+ if ( !clickedIsActive ) {
 380+ clicked
 381+ .removeClass( "ui-state-default ui-corner-all" )
 382+ .addClass( "ui-state-active ui-corner-top" )
 383+ .children( ".ui-icon" )
 384+ .removeClass( options.icons.header )
 385+ .addClass( options.icons.headerSelected );
 386+ clicked
 387+ .next()
 388+ .addClass( "ui-accordion-content-active" );
 389+ }
 390+
318391 return;
319 -
320392 },
321393
322 - _toggle: function(toShow, toHide, data, clickedIsActive, down) {
 394+ _toggle: function( toShow, toHide, data, clickedIsActive, down ) {
 395+ var self = this,
 396+ options = self.options;
323397
324 - var o = this.options, self = this;
 398+ self.toShow = toShow;
 399+ self.toHide = toHide;
 400+ self.data = data;
325401
326 - this.toShow = toShow;
327 - this.toHide = toHide;
328 - this.data = data;
 402+ var complete = function() {
 403+ if ( !self ) {
 404+ return;
 405+ }
 406+ return self._completed.apply( self, arguments );
 407+ };
329408
330 - var complete = function() { if(!self) return; return self._completed.apply(self, arguments); };
331 -
332409 // trigger changestart event
333 - this._trigger("changestart", null, this.data);
 410+ self._trigger( "changestart", null, self.data );
334411
335412 // count elements to animate
336 - this.running = toHide.size() === 0 ? toShow.size() : toHide.size();
 413+ self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
337414
338 - if (o.animated) {
339 -
 415+ if ( options.animated ) {
340416 var animOptions = {};
341417
342 - if ( o.collapsible && clickedIsActive ) {
 418+ if ( options.collapsible && clickedIsActive ) {
343419 animOptions = {
344 - toShow: $([]),
 420+ toShow: $( [] ),
345421 toHide: toHide,
346422 complete: complete,
347423 down: down,
348 - autoHeight: o.autoHeight || o.fillSpace
 424+ autoHeight: options.autoHeight || options.fillSpace
349425 };
350426 } else {
351427 animOptions = {
@@ -352,101 +428,120 @@
353429 toHide: toHide,
354430 complete: complete,
355431 down: down,
356 - autoHeight: o.autoHeight || o.fillSpace
 432+ autoHeight: options.autoHeight || options.fillSpace
357433 };
358434 }
359435
360 - if (!o.proxied) {
361 - o.proxied = o.animated;
 436+ if ( !options.proxied ) {
 437+ options.proxied = options.animated;
362438 }
363439
364 - if (!o.proxiedDuration) {
365 - o.proxiedDuration = o.duration;
 440+ if ( !options.proxiedDuration ) {
 441+ options.proxiedDuration = options.duration;
366442 }
367443
368 - o.animated = $.isFunction(o.proxied) ?
369 - o.proxied(animOptions) : o.proxied;
 444+ options.animated = $.isFunction( options.proxied ) ?
 445+ options.proxied( animOptions ) :
 446+ options.proxied;
370447
371 - o.duration = $.isFunction(o.proxiedDuration) ?
372 - o.proxiedDuration(animOptions) : o.proxiedDuration;
 448+ options.duration = $.isFunction( options.proxiedDuration ) ?
 449+ options.proxiedDuration( animOptions ) :
 450+ options.proxiedDuration;
373451
374452 var animations = $.ui.accordion.animations,
375 - duration = o.duration,
376 - easing = o.animated;
 453+ duration = options.duration,
 454+ easing = options.animated;
377455
378 - if (easing && !animations[easing] && !$.easing[easing]) {
379 - easing = 'slide';
 456+ if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
 457+ easing = "slide";
380458 }
381 - if (!animations[easing]) {
382 - animations[easing] = function(options) {
383 - this.slide(options, {
 459+ if ( !animations[ easing ] ) {
 460+ animations[ easing ] = function( options ) {
 461+ this.slide( options, {
384462 easing: easing,
385463 duration: duration || 700
386464 });
387465 };
388466 }
389467
390 - animations[easing](animOptions);
391 -
 468+ animations[ easing ]( animOptions );
392469 } else {
393 -
394 - if (o.collapsible && clickedIsActive) {
 470+ if ( options.collapsible && clickedIsActive ) {
395471 toShow.toggle();
396472 } else {
397473 toHide.hide();
398474 toShow.show();
399475 }
400476
401 - complete(true);
402 -
 477+ complete( true );
403478 }
404479
405480 // TODO assert that the blur and focus triggers are really necessary, remove otherwise
406 - toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur();
407 - toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();
408 -
 481+ toHide.prev()
 482+ .attr({
 483+ "aria-expanded": "false",
 484+ "aria-selected": "false",
 485+ tabIndex: -1
 486+ })
 487+ .blur();
 488+ toShow.prev()
 489+ .attr({
 490+ "aria-expanded": "true",
 491+ "aria-selected": "true",
 492+ tabIndex: 0
 493+ })
 494+ .focus();
409495 },
410496
411 - _completed: function(cancel) {
412 -
413 - var o = this.options;
414 -
 497+ _completed: function( cancel ) {
415498 this.running = cancel ? 0 : --this.running;
416 - if (this.running) return;
 499+ if ( this.running ) {
 500+ return;
 501+ }
417502
418 - if (o.clearStyle) {
419 - this.toShow.add(this.toHide).css({
 503+ if ( this.options.clearStyle ) {
 504+ this.toShow.add( this.toHide ).css({
420505 height: "",
421506 overflow: ""
422507 });
423508 }
424 -
 509+
425510 // other classes are removed before the animation; this one needs to stay until completed
426 - this.toHide.removeClass("ui-accordion-content-active");
 511+ this.toHide.removeClass( "ui-accordion-content-active" );
 512+ // Work around for rendering bug in IE (#5421)
 513+ if ( this.toHide.length ) {
 514+ this.toHide.parent()[0].className = this.toHide.parent()[0].className;
 515+ }
427516
428 - this._trigger('change', null, this.data);
 517+ this._trigger( "change", null, this.data );
429518 }
430 -
431519 });
432520
433 -
434 -$.extend($.ui.accordion, {
435 - version: "1.8.2",
 521+$.extend( $.ui.accordion, {
 522+ version: "1.8.11",
436523 animations: {
437 - slide: function(options, additions) {
 524+ slide: function( options, additions ) {
438525 options = $.extend({
439526 easing: "swing",
440527 duration: 300
441 - }, options, additions);
 528+ }, options, additions );
442529 if ( !options.toHide.size() ) {
443 - options.toShow.animate({height: "show"}, options);
 530+ options.toShow.animate({
 531+ height: "show",
 532+ paddingTop: "show",
 533+ paddingBottom: "show"
 534+ }, options );
444535 return;
445536 }
446537 if ( !options.toShow.size() ) {
447 - options.toHide.animate({height: "hide"}, options);
 538+ options.toHide.animate({
 539+ height: "hide",
 540+ paddingTop: "hide",
 541+ paddingBottom: "hide"
 542+ }, options );
448543 return;
449544 }
450 - var overflow = options.toShow.css('overflow'),
 545+ var overflow = options.toShow.css( "overflow" ),
451546 percentDone = 0,
452547 showProps = {},
453548 hideProps = {},
@@ -455,45 +550,57 @@
456551 // fix width before calculating height of hidden element
457552 var s = options.toShow;
458553 originalWidth = s[0].style.width;
459 - 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) );
460 -
461 - $.each(fxAttrs, function(i, prop) {
462 - hideProps[prop] = 'hide';
463 -
464 - var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
465 - showProps[prop] = {
466 - value: parts[1],
467 - unit: parts[2] || 'px'
 554+ s.width( parseInt( s.parent().width(), 10 )
 555+ - parseInt( s.css( "paddingLeft" ), 10 )
 556+ - parseInt( s.css( "paddingRight" ), 10 )
 557+ - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 )
 558+ - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) );
 559+
 560+ $.each( fxAttrs, function( i, prop ) {
 561+ hideProps[ prop ] = "hide";
 562+
 563+ var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
 564+ showProps[ prop ] = {
 565+ value: parts[ 1 ],
 566+ unit: parts[ 2 ] || "px"
468567 };
469568 });
470 - options.toShow.css({ height: 0, overflow: 'hidden' }).show();
471 - options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{
472 - step: function(now, settings) {
 569+ options.toShow.css({ height: 0, overflow: "hidden" }).show();
 570+ options.toHide
 571+ .filter( ":hidden" )
 572+ .each( options.complete )
 573+ .end()
 574+ .filter( ":visible" )
 575+ .animate( hideProps, {
 576+ step: function( now, settings ) {
473577 // only calculate the percent when animating height
474578 // IE gets very inconsistent results when animating elements
475579 // with small values, which is common for padding
476 - if (settings.prop == 'height') {
 580+ if ( settings.prop == "height" ) {
477581 percentDone = ( settings.end - settings.start === 0 ) ? 0 :
478 - (settings.now - settings.start) / (settings.end - settings.start);
 582+ ( settings.now - settings.start ) / ( settings.end - settings.start );
479583 }
480 -
481 - options.toShow[0].style[settings.prop] =
482 - (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
 584+
 585+ options.toShow[ 0 ].style[ settings.prop ] =
 586+ ( percentDone * showProps[ settings.prop ].value )
 587+ + showProps[ settings.prop ].unit;
483588 },
484589 duration: options.duration,
485590 easing: options.easing,
486591 complete: function() {
487592 if ( !options.autoHeight ) {
488 - options.toShow.css("height", "");
 593+ options.toShow.css( "height", "" );
489594 }
490 - options.toShow.css("width", originalWidth);
491 - options.toShow.css({overflow: overflow});
 595+ options.toShow.css({
 596+ width: originalWidth,
 597+ overflow: overflow
 598+ });
492599 options.complete();
493600 }
494601 });
495602 },
496 - bounceslide: function(options) {
497 - this.slide(options, {
 603+ bounceslide: function( options ) {
 604+ this.slide( options, {
498605 easing: options.down ? "easeOutBounce" : "swing",
499606 duration: options.down ? 1000 : 200
500607 });
@@ -501,4 +608,4 @@
502609 }
503610 });
504611
505 -})(jQuery);
 612+})( jQuery );
Index: trunk/phase3/resources/jquery.ui/jquery.ui.autocomplete.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Autocomplete 1.8.2
 3+ * jQuery UI Autocomplete 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Autocomplete
1010 *
@@ -12,16 +12,32 @@
1313 * jquery.ui.widget.js
1414 * jquery.ui.position.js
1515 */
16 -(function( $ ) {
 16+(function( $, undefined ) {
1717
 18+// used to prevent race conditions with remote data sources
 19+var requestIndex = 0;
 20+
1821 $.widget( "ui.autocomplete", {
1922 options: {
 23+ appendTo: "body",
 24+ autoFocus: false,
 25+ delay: 300,
2026 minLength: 1,
21 - delay: 300
 27+ position: {
 28+ my: "left top",
 29+ at: "left bottom",
 30+ collision: "none"
 31+ },
 32+ source: null
2233 },
 34+
 35+ pending: 0,
 36+
2337 _create: function() {
2438 var self = this,
25 - doc = this.element[ 0 ].ownerDocument;
 39+ doc = this.element[ 0 ].ownerDocument,
 40+ suppressKeyPress;
 41+
2642 this.element
2743 .addClass( "ui-autocomplete-input" )
2844 .attr( "autocomplete", "off" )
@@ -32,6 +48,11 @@
3349 "aria-haspopup": "true"
3450 })
3551 .bind( "keydown.autocomplete", function( event ) {
 52+ if ( self.options.disabled || self.element.attr( "readonly" ) ) {
 53+ return;
 54+ }
 55+
 56+ suppressKeyPress = false;
3657 var keyCode = $.ui.keyCode;
3758 switch( event.keyCode ) {
3859 case keyCode.PAGE_UP:
@@ -52,8 +73,11 @@
5374 break;
5475 case keyCode.ENTER:
5576 case keyCode.NUMPAD_ENTER:
56 - // when menu is open or has focus
 77+ // when menu is open and has focus
5778 if ( self.menu.active ) {
 79+ // #6055 - Opera still allows the keypress to occur
 80+ // which causes forms to submit
 81+ suppressKeyPress = true;
5882 event.preventDefault();
5983 }
6084 //passthrough - ENTER and TAB both select the current element
@@ -67,33 +91,38 @@
6892 self.element.val( self.term );
6993 self.close( event );
7094 break;
71 - case keyCode.LEFT:
72 - case keyCode.RIGHT:
73 - case keyCode.SHIFT:
74 - case keyCode.CONTROL:
75 - case keyCode.ALT:
76 - case keyCode.COMMAND:
77 - case keyCode.COMMAND_RIGHT:
78 - case keyCode.INSERT:
79 - case keyCode.CAPS_LOCK:
80 - case keyCode.END:
81 - case keyCode.HOME:
82 - // ignore metakeys (shift, ctrl, alt)
83 - break;
8495 default:
8596 // keypress is triggered before the input value is changed
8697 clearTimeout( self.searching );
8798 self.searching = setTimeout(function() {
88 - self.search( null, event );
 99+ // only search if the value has changed
 100+ if ( self.term != self.element.val() ) {
 101+ self.selectedItem = null;
 102+ self.search( null, event );
 103+ }
89104 }, self.options.delay );
90105 break;
91106 }
92107 })
 108+ .bind( "keypress.autocomplete", function( event ) {
 109+ if ( suppressKeyPress ) {
 110+ suppressKeyPress = false;
 111+ event.preventDefault();
 112+ }
 113+ })
93114 .bind( "focus.autocomplete", function() {
 115+ if ( self.options.disabled ) {
 116+ return;
 117+ }
 118+
94119 self.selectedItem = null;
95120 self.previous = self.element.val();
96121 })
97122 .bind( "blur.autocomplete", function( event ) {
 123+ if ( self.options.disabled ) {
 124+ return;
 125+ }
 126+
98127 clearTimeout( self.searching );
99128 // clicks on the menu (or a button to trigger a search) will cause a blur event
100129 self.closing = setTimeout(function() {
@@ -107,9 +136,26 @@
108137 };
109138 this.menu = $( "<ul></ul>" )
110139 .addClass( "ui-autocomplete" )
111 - .appendTo( "body", doc )
 140+ .appendTo( $( this.options.appendTo || "body", doc )[0] )
112141 // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
113 - .mousedown(function() {
 142+ .mousedown(function( event ) {
 143+ // clicking on the scrollbar causes focus to shift to the body
 144+ // but we can't detect a mouseup or a click immediately afterward
 145+ // so we have to track the next mousedown and close the menu if
 146+ // the user clicks somewhere outside of the autocomplete
 147+ var menuElement = self.menu.element[ 0 ];
 148+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
 149+ setTimeout(function() {
 150+ $( document ).one( 'mousedown', function( event ) {
 151+ if ( event.target !== self.element[ 0 ] &&
 152+ event.target !== menuElement &&
 153+ !$.ui.contains( menuElement, event.target ) ) {
 154+ self.close();
 155+ }
 156+ });
 157+ }, 1 );
 158+ }
 159+
114160 // use another timeout to make sure the blur-event-handler on the input was already triggered
115161 setTimeout(function() {
116162 clearTimeout( self.closing );
@@ -118,7 +164,7 @@
119165 .menu({
120166 focus: function( event, ui ) {
121167 var item = ui.item.data( "item.autocomplete" );
122 - if ( false !== self._trigger( "focus", null, { item: item } ) ) {
 168+ if ( false !== self._trigger( "focus", event, { item: item } ) ) {
123169 // use value to match what will end up in the input, if it was a key event
124170 if ( /^key/.test(event.originalEvent.type) ) {
125171 self.element.val( item.value );
@@ -126,21 +172,37 @@
127173 }
128174 },
129175 selected: function( event, ui ) {
130 - var item = ui.item.data( "item.autocomplete" );
131 - if ( false !== self._trigger( "select", event, { item: item } ) ) {
132 - self.element.val( item.value );
133 - }
134 - self.close( event );
 176+ var item = ui.item.data( "item.autocomplete" ),
 177+ previous = self.previous;
 178+
135179 // only trigger when focus was lost (click on menu)
136 - var previous = self.previous;
137180 if ( self.element[0] !== doc.activeElement ) {
138181 self.element.focus();
139182 self.previous = previous;
 183+ // #6109 - IE triggers two focus events and the second
 184+ // is asynchronous, so we need to reset the previous
 185+ // term synchronously and asynchronously :-(
 186+ setTimeout(function() {
 187+ self.previous = previous;
 188+ self.selectedItem = item;
 189+ }, 1);
140190 }
 191+
 192+ if ( false !== self._trigger( "select", event, { item: item } ) ) {
 193+ self.element.val( item.value );
 194+ }
 195+ // reset the term after the select event
 196+ // this allows custom select handling to work properly
 197+ self.term = self.element.val();
 198+
 199+ self.close( event );
141200 self.selectedItem = item;
142201 },
143202 blur: function( event, ui ) {
144 - if ( self.menu.element.is(":visible") ) {
 203+ // don't set the value of the text field if it's already correct
 204+ // this prevents moving the cursor unnecessarily
 205+ if ( self.menu.element.is(":visible") &&
 206+ ( self.element.val() !== self.term ) ) {
145207 self.element.val( self.term );
146208 }
147209 }
@@ -166,15 +228,22 @@
167229 $.Widget.prototype.destroy.call( this );
168230 },
169231
170 - _setOption: function( key ) {
 232+ _setOption: function( key, value ) {
171233 $.Widget.prototype._setOption.apply( this, arguments );
172234 if ( key === "source" ) {
173235 this._initSource();
174236 }
 237+ if ( key === "appendTo" ) {
 238+ this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
 239+ }
 240+ if ( key === "disabled" && value && this.xhr ) {
 241+ this.xhr.abort();
 242+ }
175243 },
176244
177245 _initSource: function() {
178 - var array,
 246+ var self = this,
 247+ array,
179248 url;
180249 if ( $.isArray(this.options.source) ) {
181250 array = this.options.source;
@@ -184,7 +253,25 @@
185254 } else if ( typeof this.options.source === "string" ) {
186255 url = this.options.source;
187256 this.source = function( request, response ) {
188 - $.getJSON( url, request, response );
 257+ if ( self.xhr ) {
 258+ self.xhr.abort();
 259+ }
 260+ self.xhr = $.ajax({
 261+ url: url,
 262+ data: request,
 263+ dataType: "json",
 264+ autocompleteRequest: ++requestIndex,
 265+ success: function( data, status ) {
 266+ if ( this.autocompleteRequest === requestIndex ) {
 267+ response( data );
 268+ }
 269+ },
 270+ error: function() {
 271+ if ( this.autocompleteRequest === requestIndex ) {
 272+ response( [] );
 273+ }
 274+ }
 275+ });
189276 };
190277 } else {
191278 this.source = this.options.source;
@@ -193,12 +280,16 @@
194281
195282 search: function( value, event ) {
196283 value = value != null ? value : this.element.val();
 284+
 285+ // always save the actual value, not the one passed as an argument
 286+ this.term = this.element.val();
 287+
197288 if ( value.length < this.options.minLength ) {
198289 return this.close( event );
199290 }
200291
201292 clearTimeout( this.closing );
202 - if ( this._trigger("search") === false ) {
 293+ if ( this._trigger( "search", event ) === false ) {
203294 return;
204295 }
205296
@@ -206,31 +297,32 @@
207298 },
208299
209300 _search: function( value ) {
210 - this.term = this.element
211 - .addClass( "ui-autocomplete-loading" )
212 - // always save the actual value, not the one passed as an argument
213 - .val();
 301+ this.pending++;
 302+ this.element.addClass( "ui-autocomplete-loading" );
214303
215304 this.source( { term: value }, this.response );
216305 },
217306
218307 _response: function( content ) {
219 - if ( content.length ) {
 308+ if ( !this.options.disabled && content && content.length ) {
220309 content = this._normalize( content );
221310 this._suggest( content );
222311 this._trigger( "open" );
223312 } else {
224313 this.close();
225314 }
226 - this.element.removeClass( "ui-autocomplete-loading" );
 315+ this.pending--;
 316+ if ( !this.pending ) {
 317+ this.element.removeClass( "ui-autocomplete-loading" );
 318+ }
227319 },
228320
229321 close: function( event ) {
230322 clearTimeout( this.closing );
231323 if ( this.menu.element.is(":visible") ) {
232 - this._trigger( "close", event );
233324 this.menu.element.hide();
234325 this.menu.deactivate();
 326+ this._trigger( "close", event );
235327 }
236328 },
237329
@@ -261,26 +353,33 @@
262354
263355 _suggest: function( items ) {
264356 var ul = this.menu.element
265 - .empty()
266 - .zIndex( this.element.zIndex() + 1 ),
267 - menuWidth,
268 - textWidth;
 357+ .empty()
 358+ .zIndex( this.element.zIndex() + 1 );
269359 this._renderMenu( ul, items );
270360 // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
271361 this.menu.deactivate();
272362 this.menu.refresh();
273 - this.menu.element.show().position({
274 - my: "left top",
275 - at: "left bottom",
276 - of: this.element,
277 - collision: "none"
278 - });
279363
280 - menuWidth = ul.width( "" ).width();
281 - textWidth = this.element.width();
282 - ul.width( Math.max( menuWidth, textWidth ) );
 364+ // size and position menu
 365+ ul.show();
 366+ this._resizeMenu();
 367+ ul.position( $.extend({
 368+ of: this.element
 369+ }, this.options.position ));
 370+
 371+ if ( this.options.autoFocus ) {
 372+ this.menu.next( new $.Event("mouseover") );
 373+ }
283374 },
284 -
 375+
 376+ _resizeMenu: function() {
 377+ var ul = this.menu.element;
 378+ ul.outerWidth( Math.max(
 379+ ul.width( "" ).outerWidth(),
 380+ this.element.outerWidth()
 381+ ) );
 382+ },
 383+
285384 _renderMenu: function( ul, items ) {
286385 var self = this;
287386 $.each( items, function( index, item ) {
@@ -291,7 +390,7 @@
292391 _renderItem: function( ul, item) {
293392 return $( "<li></li>" )
294393 .data( "item.autocomplete", item )
295 - .append( "<a>" + item.label + "</a>" )
 394+ .append( $( "<a></a>" ).text( item.label ) )
296395 .appendTo( ul );
297396 },
298397
@@ -316,7 +415,7 @@
317416
318417 $.extend( $.ui.autocomplete, {
319418 escapeRegex: function( value ) {
320 - return value.replace( /([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1" );
 419+ return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
321420 },
322421 filter: function(array, term) {
323422 var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
@@ -335,9 +434,9 @@
336435 * it for the next release. You're welcome to give it a try anyway and give us feedback,
337436 * as long as you're okay with migrating your code later on. We can help with that, too.
338437 *
339 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
340 - * Dual licensed under the MIT (MIT-LICENSE.txt)
341 - * and GPL (GPL-LICENSE.txt) licenses.
 438+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 439+ * Dual licensed under the MIT or GPL Version 2 licenses.
 440+ * http://jquery.org/license
342441 *
343442 * http://docs.jquery.com/UI/Menu
344443 *
@@ -395,7 +494,7 @@
396495 elementHeight = this.element.height();
397496 if (offset < 0) {
398497 this.element.attr("scrollTop", scroll + offset);
399 - } else if (offset > elementHeight) {
 498+ } else if (offset >= elementHeight) {
400499 this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
401500 }
402501 }
@@ -426,11 +525,11 @@
427526 },
428527
429528 first: function() {
430 - return this.active && !this.active.prev().length;
 529+ return this.active && !this.active.prevAll(".ui-menu-item").length;
431530 },
432531
433532 last: function() {
434 - return this.active && !this.active.next().length;
 533+ return this.active && !this.active.nextAll(".ui-menu-item").length;
435534 },
436535
437536 move: function(direction, edge, event) {
@@ -451,12 +550,12 @@
452551 if (this.hasScroll()) {
453552 // TODO merge with no-scroll-else
454553 if (!this.active || this.last()) {
455 - this.activate(event, this.element.children(":first"));
 554+ this.activate(event, this.element.children(".ui-menu-item:first"));
456555 return;
457556 }
458557 var base = this.active.offset().top,
459558 height = this.element.height(),
460 - result = this.element.children("li").filter(function() {
 559+ result = this.element.children(".ui-menu-item").filter(function() {
461560 var close = $(this).offset().top - base - height + $(this).height();
462561 // TODO improve approximation
463562 return close < 10 && close > -10;
@@ -464,11 +563,12 @@
465564
466565 // TODO try to catch this earlier when scrollTop indicates the last page anyway
467566 if (!result.length) {
468 - result = this.element.children(":last");
 567+ result = this.element.children(".ui-menu-item:last");
469568 }
470569 this.activate(event, result);
471570 } else {
472 - this.activate(event, this.element.children(!this.active || this.last() ? ":first" : ":last"));
 571+ this.activate(event, this.element.children(".ui-menu-item")
 572+ .filter(!this.active || this.last() ? ":first" : ":last"));
473573 }
474574 },
475575
@@ -477,13 +577,13 @@
478578 if (this.hasScroll()) {
479579 // TODO merge with no-scroll-else
480580 if (!this.active || this.first()) {
481 - this.activate(event, this.element.children(":last"));
 581+ this.activate(event, this.element.children(".ui-menu-item:last"));
482582 return;
483583 }
484584
485585 var base = this.active.offset().top,
486586 height = this.element.height();
487 - result = this.element.children("li").filter(function() {
 587+ result = this.element.children(".ui-menu-item").filter(function() {
488588 var close = $(this).offset().top - base + height - $(this).height();
489589 // TODO improve approximation
490590 return close < 10 && close > -10;
@@ -491,11 +591,12 @@
492592
493593 // TODO try to catch this earlier when scrollTop indicates the last page anyway
494594 if (!result.length) {
495 - result = this.element.children(":first");
 595+ result = this.element.children(".ui-menu-item:first");
496596 }
497597 this.activate(event, result);
498598 } else {
499 - this.activate(event, this.element.children(!this.active || this.first() ? ":last" : ":first"));
 599+ this.activate(event, this.element.children(".ui-menu-item")
 600+ .filter(!this.active || this.first() ? ":last" : ":first"));
500601 }
501602 },
502603
Index: trunk/phase3/resources/jquery.ui/jquery.ui.selectable.js
@@ -1,10 +1,9 @@
2 -
32 /*
4 - * jQuery UI Selectable 1.8.2
 3+ * jQuery UI Selectable 1.8.11
54 *
6 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
7 - * Dual licensed under the MIT (MIT-LICENSE.txt)
8 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
98 *
109 * http://docs.jquery.com/UI/Selectables
1110 *
@@ -13,7 +12,7 @@
1413 * jquery.ui.mouse.js
1514 * jquery.ui.widget.js
1615 */
17 -(function($) {
 16+(function( $, undefined ) {
1817
1918 $.widget("ui.selectable", $.ui.mouse, {
2019 options: {
@@ -90,8 +89,6 @@
9190 $(options.appendTo).append(this.helper);
9291 // position helper (lasso)
9392 this.helper.css({
94 - "z-index": 100,
95 - "position": "absolute",
9693 "left": event.clientX,
9794 "top": event.clientY,
9895 "width": 0,
@@ -263,7 +260,7 @@
264261 });
265262
266263 $.extend($.ui.selectable, {
267 - version: "1.8.2"
 264+ version: "1.8.11"
268265 });
269266
270267 })(jQuery);
Index: trunk/phase3/resources/jquery.ui/jquery.ui.position.js
@@ -1,20 +1,19 @@
22 /*
3 - * jQuery UI Position 1.8.2
 3+ * jQuery UI Position 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Position
1010 */
11 -(function( $ ) {
 11+(function( $, undefined ) {
1212
1313 $.ui = $.ui || {};
1414
1515 var horizontalPositions = /left|center|right/,
16 - horizontalDefault = "center",
1716 verticalPositions = /top|center|bottom/,
18 - verticalDefault = "center",
 17+ center = "center",
1918 _position = $.fn.position,
2019 _offset = $.fn.offset;
2120
@@ -27,21 +26,23 @@
2827 options = $.extend( {}, options );
2928
3029 var target = $( options.of ),
 30+ targetElem = target[0],
3131 collision = ( options.collision || "flip" ).split( " " ),
3232 offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
3333 targetWidth,
3434 targetHeight,
3535 basePosition;
3636
37 - if ( options.of.nodeType === 9 ) {
 37+ if ( targetElem.nodeType === 9 ) {
3838 targetWidth = target.width();
3939 targetHeight = target.height();
4040 basePosition = { top: 0, left: 0 };
41 - } else if ( options.of.scrollTo && options.of.document ) {
 41+ // TODO: use $.isWindow() in 1.9
 42+ } else if ( targetElem.setTimeout ) {
4243 targetWidth = target.width();
4344 targetHeight = target.height();
4445 basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
45 - } else if ( options.of.preventDefault ) {
 46+ } else if ( targetElem.preventDefault ) {
4647 // force left top to allow flipping
4748 options.at = "left top";
4849 targetWidth = targetHeight = 0;
@@ -58,13 +59,13 @@
5960 var pos = ( options[this] || "" ).split( " " );
6061 if ( pos.length === 1) {
6162 pos = horizontalPositions.test( pos[0] ) ?
62 - pos.concat( [verticalDefault] ) :
 63+ pos.concat( [center] ) :
6364 verticalPositions.test( pos[0] ) ?
64 - [ horizontalDefault ].concat( pos ) :
65 - [ horizontalDefault, verticalDefault ];
 65+ [ center ].concat( pos ) :
 66+ [ center, center ];
6667 }
67 - pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : horizontalDefault;
68 - pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : verticalDefault;
 68+ pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
 69+ pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
6970 options[ this ] = pos;
7071 });
7172
@@ -82,13 +83,13 @@
8384
8485 if ( options.at[0] === "right" ) {
8586 basePosition.left += targetWidth;
86 - } else if (options.at[0] === horizontalDefault ) {
 87+ } else if ( options.at[0] === center ) {
8788 basePosition.left += targetWidth / 2;
8889 }
8990
9091 if ( options.at[1] === "bottom" ) {
9192 basePosition.top += targetHeight;
92 - } else if ( options.at[1] === verticalDefault ) {
 93+ } else if ( options.at[1] === center ) {
9394 basePosition.top += targetHeight / 2;
9495 }
9596
@@ -99,24 +100,36 @@
100101 var elem = $( this ),
101102 elemWidth = elem.outerWidth(),
102103 elemHeight = elem.outerHeight(),
103 - position = $.extend( {}, basePosition );
 104+ marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
 105+ marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
 106+ collisionWidth = elemWidth + marginLeft +
 107+ ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
 108+ collisionHeight = elemHeight + marginTop +
 109+ ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
 110+ position = $.extend( {}, basePosition ),
 111+ collisionPosition;
104112
105113 if ( options.my[0] === "right" ) {
106114 position.left -= elemWidth;
107 - } else if ( options.my[0] === horizontalDefault ) {
 115+ } else if ( options.my[0] === center ) {
108116 position.left -= elemWidth / 2;
109117 }
110118
111119 if ( options.my[1] === "bottom" ) {
112120 position.top -= elemHeight;
113 - } else if ( options.my[1] === verticalDefault ) {
 121+ } else if ( options.my[1] === center ) {
114122 position.top -= elemHeight / 2;
115123 }
116124
117125 // prevent fractions (see #5280)
118 - position.left = parseInt( position.left );
119 - position.top = parseInt( position.top );
 126+ position.left = Math.round( position.left );
 127+ position.top = Math.round( position.top );
120128
 129+ collisionPosition = {
 130+ left: position.left - marginLeft,
 131+ top: position.top - marginTop
 132+ };
 133+
121134 $.each( [ "left", "top" ], function( i, dir ) {
122135 if ( $.ui.position[ collision[i] ] ) {
123136 $.ui.position[ collision[i] ][ dir ]( position, {
@@ -124,6 +137,9 @@
125138 targetHeight: targetHeight,
126139 elemWidth: elemWidth,
127140 elemHeight: elemHeight,
 141+ collisionPosition: collisionPosition,
 142+ collisionWidth: collisionWidth,
 143+ collisionHeight: collisionHeight,
128144 offset: offset,
129145 my: options.my,
130146 at: options.at
@@ -142,41 +158,44 @@
143159 fit: {
144160 left: function( position, data ) {
145161 var win = $( window ),
146 - over = position.left + data.elemWidth - win.width() - win.scrollLeft();
147 - position.left = over > 0 ? position.left - over : Math.max( 0, position.left );
 162+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
 163+ position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
148164 },
149165 top: function( position, data ) {
150166 var win = $( window ),
151 - over = position.top + data.elemHeight - win.height() - win.scrollTop();
152 - position.top = over > 0 ? position.top - over : Math.max( 0, position.top );
 167+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
 168+ position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
153169 }
154170 },
155171
156172 flip: {
157173 left: function( position, data ) {
158 - if ( data.at[0] === "center" ) {
 174+ if ( data.at[0] === center ) {
159175 return;
160176 }
161177 var win = $( window ),
162 - over = position.left + data.elemWidth - win.width() - win.scrollLeft(),
 178+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
163179 myOffset = data.my[ 0 ] === "left" ?
164180 -data.elemWidth :
165181 data.my[ 0 ] === "right" ?
166182 data.elemWidth :
167183 0,
 184+ atOffset = data.at[ 0 ] === "left" ?
 185+ data.targetWidth :
 186+ -data.targetWidth,
168187 offset = -2 * data.offset[ 0 ];
169 - position.left += position.left < 0 ?
170 - myOffset + data.targetWidth + offset :
 188+ position.left += data.collisionPosition.left < 0 ?
 189+ myOffset + atOffset + offset :
171190 over > 0 ?
172 - myOffset - data.targetWidth + offset :
 191+ myOffset + atOffset + offset :
173192 0;
174193 },
175194 top: function( position, data ) {
176 - if ( data.at[1] === "center" ) {
 195+ if ( data.at[1] === center ) {
177196 return;
178197 }
179198 var win = $( window ),
180 - over = position.top + data.elemHeight - win.height() - win.scrollTop(),
 199+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
181200 myOffset = data.my[ 1 ] === "top" ?
182201 -data.elemHeight :
183202 data.my[ 1 ] === "bottom" ?
@@ -186,8 +205,8 @@
187206 data.targetHeight :
188207 -data.targetHeight,
189208 offset = -2 * data.offset[ 1 ];
190 - position.top += position.top < 0 ?
191 - myOffset + data.targetHeight + offset :
 209+ position.top += data.collisionPosition.top < 0 ?
 210+ myOffset + atOffset + offset :
192211 over > 0 ?
193212 myOffset + atOffset + offset :
194213 0;
Index: trunk/phase3/resources/jquery.ui/jquery.ui.droppable.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Droppable 1.8.2
 3+ * jQuery UI Droppable 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Droppables
1010 *
@@ -13,7 +13,7 @@
1414 * jquery.ui.mouse.js
1515 * jquery.ui.draggable.js
1616 */
17 -(function($) {
 17+(function( $, undefined ) {
1818
1919 $.widget("ui.droppable", {
2020 widgetEventPrefix: "drop",
@@ -147,7 +147,7 @@
148148 });
149149
150150 $.extend($.ui.droppable, {
151 - version: "1.8.2"
 151+ version: "1.8.11"
152152 });
153153
154154 $.ui.intersect = function(draggable, droppable, toleranceMode) {
@@ -161,8 +161,8 @@
162162
163163 switch (toleranceMode) {
164164 case 'fit':
165 - return (l < x1 && x2 < r
166 - && t < y1 && y2 < b);
 165+ return (l <= x1 && x2 <= r
 166+ && t <= y1 && y2 <= b);
167167 break;
168168 case 'intersect':
169169 return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
@@ -212,11 +212,11 @@
213213 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
214214 m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
215215
 216+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
 217+
216218 m[i].offset = m[i].element.offset();
217219 m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
218220
219 - if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
220 -
221221 }
222222
223223 },
Index: trunk/phase3/resources/jquery.ui/jquery.ui.draggable.js
@@ -1,9 +1,9 @@
22 /*
3 - * jQuery UI Draggable 1.8.2
 3+ * jQuery UI Draggable 1.8.11
44 *
5 - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
6 - * Dual licensed under the MIT (MIT-LICENSE.txt)
7 - * and GPL (GPL-LICENSE.txt) licenses.
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
88 *
99 * http://docs.jquery.com/UI/Draggables
1010 *
@@ -12,7 +12,7 @@
1313 * jquery.ui.mouse.js
1414 * jquery.ui.widget.js
1515 */
16 -(function($) {
 16+(function( $, undefined ) {
1717
1818 $.widget("ui.draggable", $.ui.mouse, {
1919 widgetEventPrefix: "drag",
@@ -192,8 +192,8 @@
193193 this.dropped = false;
194194 }
195195
196 - //if the original element is removed, don't bother to continue
197 - if(!this.element[0] || !this.element[0].parentNode)
 196+ //if the original element is removed, don't bother to continue if helper is set to "original"
 197+ if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
198198 return false;
199199
200200 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 @@
318318 _cacheMargins: function() {
319319 this.margins = {
320320 left: (parseInt(this.element.css("marginLeft"),10) || 0),
321 - top: (parseInt(this.element.css("marginTop"),10) || 0)
 321+ top: (parseInt(this.element.css("marginTop"),10) || 0),
 322+ right: (parseInt(this.element.css("marginRight"),10) || 0),
 323+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
322324 };
323325 },
324326
@@ -333,10 +335,10 @@
334336 var o = this.options;
335337 if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
336338 if(o.containment == 'document' || o.containment == 'window') this.containment = [
337 - 0 - this.offset.relative.left - this.offset.parent.left,
338 - 0 - this.offset.relative.top - this.offset.parent.top,
339 - $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
340 - ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
 339+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left,
 340+ (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top,
 341+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
 342+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
341343 ];
342344
343345 if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
@@ -345,10 +347,10 @@
346348 var over = ($(ce).css("overflow") != 'hidden');
347349
348350 this.containment = [
349 - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
350 - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
351 - 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,
352 - 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
 351+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
 352+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
 353+ 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,
 354+ 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
353355 ];
354356 } else if(o.containment.constructor == Array) {
355357 this.containment = o.containment;
@@ -459,7 +461,7 @@
460462 });
461463
462464 $.extend($.ui.draggable, {
463 - version: "1.8.2"
 465+ version: "1.8.11"
464466 });
465467
466468 $.ui.plugin.add("draggable", "connectToSortable", {
@@ -475,7 +477,7 @@
476478 instance: sortable,
477479 shouldRevert: sortable.options.revert
478480 });
479 - sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
 481+ 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).
480482 sortable._trigger("activate", event, uiSortable);
481483 }
482484 });

Follow-up revisions

RevisionCommit summaryAuthorDate
r86446followup to r86046 -- reverting upgrade of datepicker. In UploadWizard, new v...neilk23:45, 19 April 2011

Status & tagging log