|
Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js?rev=1401975&r1=1401974&r2=1401975&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js Thu Oct 25 05:04:09 2012 @@ -1,18 +1,19 @@ -/* - * jQuery UI Datepicker 1.8.16 +/*! + * jQuery UI Datepicker 1.9.0 + * http://jqueryui.com * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Datepicker + * http://api.jqueryui.com/datepicker/ * * Depends: * jquery.ui.core.js */ (function( $, undefined ) { -$.extend($.ui, { datepicker: { version: "1.8.16" } }); +$.extend($.ui, { datepicker: { version: "1.9.0" } }); var PROP_NAME = 'datepicker'; var dpuuid = new Date().getTime(); @@ -233,7 +234,10 @@ $.extend(Datepicker.prototype, { inst.trigger.click(function() { if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) $.datepicker._hideDatepicker(); - else + else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) { + $.datepicker._hideDatepicker(); + $.datepicker._showDatepicker(input[0]); + } else $.datepicker._showDatepicker(input[0]); return false; }); @@ -305,7 +309,7 @@ $.extend(Datepicker.prototype, { this.uuid += 1; var id = 'dp' + this.uuid; this._dialogInput = $('<input type="text" id="' + id + - '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'); + '" style="position: absolute; top: -100px; width: 0px;"/>'); this._dialogInput.keydown(this._doKeyDown); $('body').append(this._dialogInput); inst = this._dialogInst = this._newInst(this._dialogInput, false); @@ -379,7 +383,7 @@ $.extend(Datepicker.prototype, { var inline = $target.children('.' + this._inlineClass); inline.children().removeClass('ui-state-disabled'); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - removeAttr("disabled"); + prop("disabled", false); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); // delete entry @@ -404,7 +408,7 @@ $.extend(Datepicker.prototype, { var inline = $target.children('.' + this._inlineClass); inline.children().addClass('ui-state-disabled'); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - attr("disabled", "disabled"); + prop("disabled", true); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); // delete entry @@ -617,15 +621,15 @@ $.extend(Datepicker.prototype, { $.datepicker._updateDatepicker(inst); } } - catch (event) { - $.datepicker.log(event); + catch (err) { + $.datepicker.log(err); } } return true; }, /* Pop-up the date picker for a given input field. - If false returned from beforeShow event handler do not show. + If false returned from beforeShow event handler do not show. @param input element - the input field attached to the date picker or event - if triggered by focus */ _showDatepicker: function(input) { @@ -636,15 +640,15 @@ $.extend(Datepicker.prototype, { return; var inst = $.datepicker._getInst(input); if ($.datepicker._curInst && $.datepicker._curInst != inst) { - if ( $.datepicker._datepickerShowing ) { - $.datepicker._triggerOnClose($.datepicker._curInst); - } $.datepicker._curInst.dpDiv.stop(true, true); + if ( inst && $.datepicker._datepickerShowing ) { + $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); + } } var beforeShow = $.datepicker._get(inst, 'beforeShow'); var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; if(beforeShowSettings === false){ - //false + //false return; } extendRemove(inst.settings, beforeShowSettings); @@ -662,10 +666,6 @@ $.extend(Datepicker.prototype, { isFixed |= $(this).css('position') == 'fixed'; return !isFixed; }); - if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled - $.datepicker._pos[0] -= document.documentElement.scrollLeft; - $.datepicker._pos[1] -= document.documentElement.scrollTop; - } var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; $.datepicker._pos = null; //to avoid flashes on Firefox @@ -692,7 +692,9 @@ $.extend(Datepicker.prototype, { }; inst.dpDiv.zIndex($(input).zIndex()+1); $.datepicker._datepickerShowing = true; - if ($.effects && $.effects[showAnim]) + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); @@ -706,11 +708,11 @@ $.extend(Datepicker.prototype, { /* Generate the date picker content. */ _updateDatepicker: function(inst) { - var self = this; - self.maxRows = 4; //Reset the max number of rows being displayed (see #7043) + this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) var borders = $.datepicker._getBorders(inst.dpDiv); instActive = inst; // for delegate hover events inst.dpDiv.empty().append(this._generateHTML(inst)); + this._attachHandlers(inst); var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) @@ -761,8 +763,8 @@ $.extend(Datepicker.prototype, { var dpHeight = inst.dpDiv.outerHeight(); var inputWidth = inst.input ? inst.input.outerWidth() : 0; var inputHeight = inst.input ? inst.input.outerHeight() : 0; - var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft(); - var viewHeight = document.documentElement.clientHeight + $(document).scrollTop(); + var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()); + var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; @@ -781,19 +783,11 @@ $.extend(Datepicker.prototype, { _findPos: function(obj) { var inst = this._getInst(obj); var isRTL = this._get(inst, 'isRTL'); - while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { - obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; - } - var position = $(obj).offset(); - return [position.left, position.top]; - }, - - /* Trigger custom callback of onClose. */ - _triggerOnClose: function(inst) { - var onClose = this._get(inst, 'onClose'); - if (onClose) - onClose.apply((inst.input ? inst.input[0] : null), - [(inst.input ? inst.input.val() : ''), inst]); + while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { + obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; + } + var position = $(obj).offset(); + return [position.left, position.top]; }, /* Hide the date picker from view. @@ -807,17 +801,21 @@ $.extend(Datepicker.prototype, { var duration = this._get(inst, 'duration'); var postProcess = function() { $.datepicker._tidyDialog(inst); - this._curInst = null; }; - if ($.effects && $.effects[showAnim]) + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); if (!showAnim) postProcess(); - $.datepicker._triggerOnClose(inst); this._datepickerShowing = false; + var onClose = this._get(inst, 'onClose'); + if (onClose) + onClose.apply((inst.input ? inst.input[0] : null), + [(inst.input ? inst.input.val() : ''), inst]); this._lastInput = null; if (this._inDialog) { this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); @@ -839,12 +837,16 @@ $.extend(Datepicker.prototype, { _checkExternalClick: function(event) { if (!$.datepicker._curInst) return; - var $target = $(event.target); - if ($target[0].id != $.datepicker._mainDivId && + + var $target = $(event.target), + inst = $.datepicker._getInst($target[0]); + + if ( ( ( $target[0].id != $.datepicker._mainDivId && $target.parents('#' + $.datepicker._mainDivId).length == 0 && !$target.hasClass($.datepicker.markerClassName) && - !$target.hasClass($.datepicker._triggerClass) && - $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) + !$target.closest("." + $.datepicker._triggerClass).length && + $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || + ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) ) $.datepicker._hideDatepicker(); }, @@ -1094,7 +1096,10 @@ $.extend(Datepicker.prototype, { } } if (iValue < value.length){ - throw "Extra/unparsed characters found in date: " + value.substring(iValue); + var extra = value.substr(iValue); + if (!/^\s+/.test(extra)) { + throw "Extra/unparsed characters found in date: " + extra; + } } if (year == -1) year = new Date().getFullYear(); @@ -1401,6 +1406,43 @@ $.extend(Datepicker.prototype, { return startDate; }, + /* Attach the onxxx handlers. These are declared statically so + * they work with static code transformers like Caja. + */ + _attachHandlers: function(inst) { + var stepMonths = this._get(inst, 'stepMonths'); + var id = '#' + inst.id.replace( /\\\\/g, "\\" ); + inst.dpDiv.find('[data-handler]').map(function () { + var handler = { + prev: function () { + window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M'); + }, + next: function () { + window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M'); + }, + hide: function () { + window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker(); + }, + today: function () { + window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id); + }, + selectDay: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this); + return false; + }, + selectMonth: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M'); + return false; + }, + selectYear: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y'); + return false; + } + }; + $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]); + }); + }, + /* Generate the HTML for the current state of the date picker. */ _generateHTML: function(inst) { var today = new Date(); @@ -1443,8 +1485,7 @@ $.extend(Datepicker.prototype, { this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid + - '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' + + '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' + ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' : (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>')); var nextText = this._get(inst, 'nextText'); @@ -1452,19 +1493,17 @@ $.extend(Datepicker.prototype, { this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid + - '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' + + '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' + ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' : (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>')); var currentText = this._get(inst, 'currentText'); var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid + - '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : ''); + var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' + + this._get(inst, 'closeText') + '</button>' : ''); var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') + - (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid + - '.datepicker._gotoToday(\'#' + inst.id + '\');"' + + (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' + '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; var firstDay = parseInt(this._get(inst, 'firstDay'),10); firstDay = (isNaN(firstDay) ? 0 : firstDay); @@ -1543,8 +1582,7 @@ $.extend(Datepicker.prototype, { (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title - (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' + - inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions + (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions (otherMonth && !showOtherMonths ? ' ' : // display for other months (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' + (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + @@ -1587,9 +1625,7 @@ $.extend(Datepicker.prototype, { else { var inMinYear = (minDate && minDate.getFullYear() == drawYear); var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); - monthHtml += '<select class="ui-datepicker-month" ' + - 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' + - '>'; + monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">'; for (var month = 0; month < 12; month++) { if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) @@ -1620,9 +1656,7 @@ $.extend(Datepicker.prototype, { var endYear = Math.max(year, determineYear(years[1] || '')); year = (minDate ? Math.max(year, minDate.getFullYear()) : year); endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += '<select class="ui-datepicker-year" ' + - 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' + - '>'; + inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">'; for (; year <= endYear; year++) { inst.yearshtml += '<option value="' + year + '"' + (year == drawYear ? ' selected="selected"' : '') + @@ -1743,23 +1777,18 @@ $.extend(Datepicker.prototype, { */ function bindHover(dpDiv) { var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; - return dpDiv.bind('mouseout', function(event) { - var elem = $( event.target ).closest( selector ); - if ( !elem.length ) { - return; - } - elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" ); + return dpDiv.delegate(selector, 'mouseout', function() { + $(this).removeClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); }) - .bind('mouseover', function(event) { - var elem = $( event.target ).closest( selector ); - if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) || - !elem.length ) { - return; + .delegate(selector, 'mouseover', function(){ + if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) { + $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); + $(this).addClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); } - elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); - elem.addClass('ui-state-hover'); - if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover'); - if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover'); }); } @@ -1772,15 +1801,9 @@ function extendRemove(target, props) { return target; }; -/* Determine whether an object is an array. */ -function isArray(a) { - return (a && (($.browser.safari && typeof a == 'object' && a.length) || - (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); -}; - /* Invoke the datepicker functionality. @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality + Object - settings for attaching new datepicker functionality @return jQuery object */ $.fn.datepicker = function(options){ @@ -1792,7 +1815,7 @@ $.fn.datepicker = function(options){ /* Initialise the date picker. */ if (!$.datepicker.initialized) { $(document).mousedown($.datepicker._checkExternalClick). - find('body').append($.datepicker.dpDiv); + find(document.body).append($.datepicker.dpDiv); $.datepicker.initialized = true; } @@ -1814,7 +1837,7 @@ $.fn.datepicker = function(options){ $.datepicker = new Datepicker(); // singleton instance $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.8.16"; +$.datepicker.version = "1.9.0"; // Workaround for #4055 // Add another global to avoid noConflict issues with inline event handlers Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.dialog.js URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.dialog.js?rev=1401975&r1=1401974&r2=1401975&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.dialog.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.dialog.js Thu Oct 25 05:04:09 2012 @@ -1,11 +1,12 @@ -/* - * jQuery UI Dialog 1.8.16 +/*! + * jQuery UI Dialog 1.9.0 + * http://jqueryui.com * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Dialog + * http://api.jqueryui.com/dialog/ * * Depends: * jquery.ui.core.js @@ -18,11 +19,7 @@ */ (function( $, undefined ) { -var uiDialogClasses = - 'ui-dialog ' + - 'ui-widget ' + - 'ui-widget-content ' + - 'ui-corner-all ', +var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ", sizeRelatedOptions = { buttons: true, height: true, @@ -37,173 +34,161 @@ var uiDialogClasses = maxWidth: true, minHeight: true, minWidth: true - }, - // support for jQuery 1.3.2 - handle common attrFn methods for dialog - attrFn = $.attrFn || { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true, - click: true }; $.widget("ui.dialog", { + version: "1.9.0", options: { autoOpen: true, buttons: {}, closeOnEscape: true, - closeText: 'close', - dialogClass: '', + closeText: "close", + dialogClass: "", draggable: true, hide: null, - height: 'auto', + height: "auto", maxHeight: false, maxWidth: false, minHeight: 150, minWidth: 150, modal: false, position: { - my: 'center', - at: 'center', - collision: 'fit', + my: "center", + at: "center", + of: window, + collision: "fit", // ensure that the titlebar is never outside the document - using: function(pos) { - var topOffset = $(this).css(pos).offset().top; - if (topOffset < 0) { - $(this).css('top', pos.top - topOffset); + using: function( pos ) { + var topOffset = $( this ).css( pos ).offset().top; + if ( topOffset < 0 ) { + $( this ).css( "top", pos.top - topOffset ); } } }, resizable: true, show: null, stack: true, - title: '', + title: "", width: 300, zIndex: 1000 }, _create: function() { - this.originalTitle = this.element.attr('title'); + this.originalTitle = this.element.attr( "title" ); // #5742 - .attr() might return a DOMElement if ( typeof this.originalTitle !== "string" ) { this.originalTitle = ""; } - + this.oldPosition = { + parent: this.element.parent(), + index: this.element.parent().children().index( this.element ) + }; this.options.title = this.options.title || this.originalTitle; - var self = this, - options = self.options, + var that = this, + options = this.options, - title = options.title || ' ', - titleId = $.ui.dialog.getTitleId(self.element), + title = options.title || " ", - uiDialog = (self.uiDialog = $('<div></div>')) - .appendTo(document.body) - .hide() - .addClass(uiDialogClasses + options.dialogClass) + uiDialog = ( this.uiDialog = $( "<div>" ) ) + .addClass( uiDialogClasses + options.dialogClass ) .css({ + display: "none", + outline: 0, // TODO: move to stylesheet zIndex: options.zIndex }) // setting tabIndex makes the div focusable - // setting outline to 0 prevents a border on focus in Mozilla - .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { - if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - self.close(event); + .attr( "tabIndex", -1) + .keydown(function( event ) { + if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + that.close( event ); event.preventDefault(); } }) - .attr({ - role: 'dialog', - 'aria-labelledby': titleId + .mousedown(function( event ) { + that.moveToTop( false, event ); }) - .mousedown(function(event) { - self.moveToTop(false, event); - }), + .appendTo( "body" ), - uiDialogContent = self.element + uiDialogContent = this.element .show() - .removeAttr('title') - .addClass( - 'ui-dialog-content ' + - 'ui-widget-content') - .appendTo(uiDialog), - - uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>')) - .addClass( - 'ui-dialog-titlebar ' + - 'ui-widget-header ' + - 'ui-corner-all ' + - 'ui-helper-clearfix' - ) - .prependTo(uiDialog), - - uiDialogTitlebarClose = $('<a href="#"></a>') - .addClass( - 'ui-dialog-titlebar-close ' + - 'ui-corner-all' - ) - .attr('role', 'button') - .hover( - function() { - uiDialogTitlebarClose.addClass('ui-state-hover'); - }, - function() { - uiDialogTitlebarClose.removeClass('ui-state-hover'); - } - ) - .focus(function() { - uiDialogTitlebarClose.addClass('ui-state-focus'); - }) - .blur(function() { - uiDialogTitlebarClose.removeClass('ui-state-focus'); - }) - .click(function(event) { - self.close(event); - return false; + .removeAttr( "title" ) + .addClass( "ui-dialog-content ui-widget-content" ) + .appendTo( uiDialog ), + + uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) ) + .addClass( "ui-dialog-titlebar ui-widget-header " + + "ui-corner-all ui-helper-clearfix" ) + .prependTo( uiDialog ), + + uiDialogTitlebarClose = $( "<a href='#'></a>" ) + .addClass( "ui-dialog-titlebar-close ui-corner-all" ) + .attr( "role", "button" ) + .click(function( event ) { + event.preventDefault(); + that.close( event ); }) - .appendTo(uiDialogTitlebar), + .appendTo( uiDialogTitlebar ), - uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>')) - .addClass( - 'ui-icon ' + - 'ui-icon-closethick' - ) - .text(options.closeText) - .appendTo(uiDialogTitlebarClose), + uiDialogTitlebarCloseText = ( this.uiDialogTitlebarCloseText = $( "<span>" ) ) + .addClass( "ui-icon ui-icon-closethick" ) + .text( options.closeText ) + .appendTo( uiDialogTitlebarClose ), + + uiDialogTitle = $( "<span>" ) + .uniqueId() + .addClass( "ui-dialog-title" ) + .html( title ) + .prependTo( uiDialogTitlebar ), - uiDialogTitle = $('<span></span>') - .addClass('ui-dialog-title') - .attr('id', titleId) - .html(title) - .prependTo(uiDialogTitlebar); + uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) ) + .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ), - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) { - options.beforeClose = options.beforeclose; - } + uiButtonSet = ( this.uiButtonSet = $( "<div>" ) ) + .addClass( "ui-dialog-buttonset" ) + .appendTo( uiDialogButtonPane ); + + uiDialog.attr({ + role: "dialog", + "aria-labelledby": uiDialogTitle.attr( "id" ) + }); - uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); + uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection(); + this._hoverable( uiDialogTitlebarClose ); + this._focusable( uiDialogTitlebarClose ); - if (options.draggable && $.fn.draggable) { - self._makeDraggable(); + if ( options.draggable && $.fn.draggable ) { + this._makeDraggable(); } - if (options.resizable && $.fn.resizable) { - self._makeResizable(); + if ( options.resizable && $.fn.resizable ) { + this._makeResizable(); } - self._createButtons(options.buttons); - self._isOpen = false; + this._createButtons( options.buttons ); + this._isOpen = false; - if ($.fn.bgiframe) { + if ( $.fn.bgiframe ) { uiDialog.bgiframe(); } + + // prevent tabbing out of modal dialogs + this._on( uiDialog, { keydown: function( event ) { + if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) { + return; + } + + var tabbables = $( ":tabbable", uiDialog ), + first = tabbables.filter( ":first" ), + last = tabbables.filter( ":last" ); + + if ( event.target === last[0] && !event.shiftKey ) { + first.focus( 1 ); + return false; + } else if ( event.target === first[0] && event.shiftKey ) { + last.focus( 1 ); + return false; + } + }}); }, _init: function() { @@ -212,72 +197,81 @@ $.widget("ui.dialog", { } }, - destroy: function() { - var self = this; - - if (self.overlay) { - self.overlay.destroy(); - } - self.uiDialog.hide(); - self.element - .unbind('.dialog') - .removeData('dialog') - .removeClass('ui-dialog-content ui-widget-content') - .hide().appendTo('body'); - self.uiDialog.remove(); - - if (self.originalTitle) { - self.element.attr('title', self.originalTitle); + _destroy: function() { + var next, + oldPosition = this.oldPosition; + + if ( this.overlay ) { + this.overlay.destroy(); + } + this.uiDialog.hide(); + this.element + .removeClass( "ui-dialog-content ui-widget-content" ) + .hide() + .appendTo( "body" ); + this.uiDialog.remove(); + + if ( this.originalTitle ) { + this.element.attr( "title", this.originalTitle ); + } + + next = oldPosition.parent.children().eq( oldPosition.index ); + // Don't try to place the dialog next to itself (#8613) + if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { + next.before( this.element ); + } else { + oldPosition.parent.append( this.element ); } - - return self; }, widget: function() { return this.uiDialog; }, - close: function(event) { - var self = this, + close: function( event ) { + var that = this, maxZ, thisZ; - - if (false === self._trigger('beforeClose', event)) { + + if ( !this._isOpen ) { return; } - if (self.overlay) { - self.overlay.destroy(); + if ( false === this._trigger( "beforeClose", event ) ) { + return; } - self.uiDialog.unbind('keypress.ui-dialog'); - self._isOpen = false; + this._isOpen = false; - if (self.options.hide) { - self.uiDialog.hide(self.options.hide, function() { - self._trigger('close', event); + if ( this.overlay ) { + this.overlay.destroy(); + } + + if ( this.options.hide ) { + this.uiDialog.hide( this.options.hide, function() { + that._trigger( "close", event ); }); } else { - self.uiDialog.hide(); - self._trigger('close', event); + this.uiDialog.hide(); + this._trigger( "close", event ); } $.ui.dialog.overlay.resize(); // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - if (self.options.modal) { + if ( this.options.modal ) { maxZ = 0; - $('.ui-dialog').each(function() { - if (this !== self.uiDialog[0]) { - thisZ = $(this).css('z-index'); - if(!isNaN(thisZ)) { - maxZ = Math.max(maxZ, thisZ); + $( ".ui-dialog" ).each(function() { + if ( this !== that.uiDialog[0] ) { + thisZ = $( this ).css( "z-index" ); + if ( !isNaN( thisZ ) ) { + maxZ = Math.max( maxZ, thisZ ); } } }); $.ui.dialog.maxZ = maxZ; } - return self; + return this; }, isOpen: function() { @@ -286,179 +280,156 @@ $.widget("ui.dialog", { // the force parameter allows us to move modal dialogs to their correct // position on open - moveToTop: function(force, event) { - var self = this, - options = self.options, + moveToTop: function( force, event ) { + var options = this.options, saveScroll; - if ((options.modal && !force) || - (!options.stack && !options.modal)) { - return self._trigger('focus', event); + if ( ( options.modal && !force ) || + ( !options.stack && !options.modal ) ) { + return this._trigger( "focus", event ); } - if (options.zIndex > $.ui.dialog.maxZ) { + if ( options.zIndex > $.ui.dialog.maxZ ) { $.ui.dialog.maxZ = options.zIndex; } - if (self.overlay) { + if ( this.overlay ) { $.ui.dialog.maxZ += 1; - self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ); + $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ; + this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ ); } - //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. - // http://ui.jquery.com/bugs/ticket/3193 - saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() }; + // Save and then restore scroll + // Opera 9.5+ resets when parent z-index is changed. + // http://bugs.jqueryui.com/ticket/3193 + saveScroll = { + scrollTop: this.element.scrollTop(), + scrollLeft: this.element.scrollLeft() + }; $.ui.dialog.maxZ += 1; - self.uiDialog.css('z-index', $.ui.dialog.maxZ); - self.element.attr(saveScroll); - self._trigger('focus', event); + this.uiDialog.css( "z-index", $.ui.dialog.maxZ ); + this.element.attr( saveScroll ); + this._trigger( "focus", event ); - return self; + return this; }, open: function() { - if (this._isOpen) { return; } - - var self = this, - options = self.options, - uiDialog = self.uiDialog; - - self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; - self._size(); - self._position(options.position); - uiDialog.show(options.show); - self.moveToTop(true); - - // prevent tabbing out of modal dialogs - if (options.modal) { - uiDialog.bind('keypress.ui-dialog', function(event) { - if (event.keyCode !== $.ui.keyCode.TAB) { - return; - } - - var tabbables = $(':tabbable', this), - first = tabbables.filter(':first'), - last = tabbables.filter(':last'); - - if (event.target === last[0] && !event.shiftKey) { - first.focus(1); - return false; - } else if (event.target === first[0] && event.shiftKey) { - last.focus(1); - return false; - } - }); + if ( this._isOpen ) { + return; } + var hasFocus, + options = this.options, + uiDialog = this.uiDialog; + + this._size(); + this._position( options.position ); + uiDialog.show( options.show ); + this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null; + this.moveToTop( true ); + // set focus to the first tabbable element in the content area or the first button // if there are no tabbable elements, set focus on the dialog itself - $(self.element.find(':tabbable').get().concat( - uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( - uiDialog.get()))).eq(0).focus(); - - self._isOpen = true; - self._trigger('open'); - - return self; - }, - - _createButtons: function(buttons) { - var self = this, - hasButtons = false, - uiDialogButtonPane = $('<div></div>') - .addClass( - 'ui-dialog-buttonpane ' + - 'ui-widget-content ' + - 'ui-helper-clearfix' - ), - uiButtonSet = $( "<div></div>" ) - .addClass( "ui-dialog-buttonset" ) - .appendTo( uiDialogButtonPane ); + hasFocus = this.element.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = uiDialog; + } + } + hasFocus.eq( 0 ).focus(); + + this._isOpen = true; + this._trigger( "open" ); + + return this; + }, + + _createButtons: function( buttons ) { + var uiDialogButtonPane, uiButtonSet, + that = this, + hasButtons = false; // if we already have a button pane, remove it - self.uiDialog.find('.ui-dialog-buttonpane').remove(); + this.uiDialogButtonPane.remove(); + this.uiButtonSet.empty(); - if (typeof buttons === 'object' && buttons !== null) { - $.each(buttons, function() { + if ( typeof buttons === "object" && buttons !== null ) { + $.each( buttons, function() { return !(hasButtons = true); }); } - if (hasButtons) { - $.each(buttons, function(name, props) { + if ( hasButtons ) { + $.each( buttons, function( name, props ) { props = $.isFunction( props ) ? { click: props, text: name } : props; - var button = $('<button type="button"></button>') + var button = $( "<button type='button'>" ) + .attr( props, true ) + .unbind( "click" ) .click(function() { - props.click.apply(self.element[0], arguments); + props.click.apply( that.element[0], arguments ); }) - .appendTo(uiButtonSet); - // can't use .attr( props, true ) with jQuery 1.3.2. - $.each( props, function( key, value ) { - if ( key === "click" ) { - return; - } - if ( key in attrFn ) { - button[ key ]( value ); - } else { - button.attr( key, value ); - } - }); - if ($.fn.button) { + .appendTo( that.uiButtonSet ); + if ( $.fn.button ) { button.button(); } }); - uiDialogButtonPane.appendTo(self.uiDialog); + this.uiDialog.addClass( "ui-dialog-buttons" ); + this.uiDialogButtonPane.appendTo( this.uiDialog ); + } else { + this.uiDialog.removeClass( "ui-dialog-buttons" ); } }, _makeDraggable: function() { - var self = this, - options = self.options, - doc = $(document), - heightBeforeDrag; + var that = this, + options = this.options; - function filteredUi(ui) { + function filteredUi( ui ) { return { position: ui.position, offset: ui.offset }; } - self.uiDialog.draggable({ - cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', - handle: '.ui-dialog-titlebar', - containment: 'document', - start: function(event, ui) { - heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height(); - $(this).height($(this).height()).addClass("ui-dialog-dragging"); - self._trigger('dragStart', event, filteredUi(ui)); + this.uiDialog.draggable({ + cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", + handle: ".ui-dialog-titlebar", + containment: "document", + start: function( event, ui ) { + $( this ) + .addClass( "ui-dialog-dragging" ); + that._trigger( "dragStart", event, filteredUi( ui ) ); }, - drag: function(event, ui) { - self._trigger('drag', event, filteredUi(ui)); + drag: function( event, ui ) { + that._trigger( "drag", event, filteredUi( ui ) ); }, - stop: function(event, ui) { - options.position = [ui.position.left - doc.scrollLeft(), - ui.position.top - doc.scrollTop()]; - $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); - self._trigger('dragStop', event, filteredUi(ui)); + stop: function( event, ui ) { + options.position = [ + ui.position.left - that.document.scrollLeft(), + ui.position.top - that.document.scrollTop() + ]; + $( this ) + .removeClass( "ui-dialog-dragging" ); + that._trigger( "dragStop", event, filteredUi( ui ) ); $.ui.dialog.overlay.resize(); } }); }, - _makeResizable: function(handles) { + _makeResizable: function( handles ) { handles = (handles === undefined ? this.options.resizable : handles); - var self = this, - options = self.options, + var that = this, + options = this.options, // .ui-resizable has position: relative defined in the stylesheet // but dialogs have to use absolute or fixed positioning - position = self.uiDialog.css('position'), - resizeHandles = (typeof handles === 'string' ? + position = this.uiDialog.css( "position" ), + resizeHandles = typeof handles === 'string' ? handles : - 'n,e,s,w,se,sw,ne,nw' - ); + "n,e,s,w,se,sw,ne,nw"; - function filteredUi(ui) { + function filteredUi( ui ) { return { originalPosition: ui.originalPosition, originalSize: ui.originalSize, @@ -467,101 +438,99 @@ $.widget("ui.dialog", { }; } - self.uiDialog.resizable({ - cancel: '.ui-dialog-content', - containment: 'document', - alsoResize: self.element, + this.uiDialog.resizable({ + cancel: ".ui-dialog-content", + containment: "document", + alsoResize: this.element, maxWidth: options.maxWidth, maxHeight: options.maxHeight, minWidth: options.minWidth, - minHeight: self._minHeight(), + minHeight: this._minHeight(), handles: resizeHandles, - start: function(event, ui) { - $(this).addClass("ui-dialog-resizing"); - self._trigger('resizeStart', event, filteredUi(ui)); + start: function( event, ui ) { + $( this ).addClass( "ui-dialog-resizing" ); + that._trigger( "resizeStart", event, filteredUi( ui ) ); }, - resize: function(event, ui) { - self._trigger('resize', event, filteredUi(ui)); + resize: function( event, ui ) { + that._trigger( "resize", event, filteredUi( ui ) ); }, - stop: function(event, ui) { - $(this).removeClass("ui-dialog-resizing"); - options.height = $(this).height(); - options.width = $(this).width(); - self._trigger('resizeStop', event, filteredUi(ui)); + stop: function( event, ui ) { + $( this ).removeClass( "ui-dialog-resizing" ); + options.height = $( this ).height(); + options.width = $( this ).width(); + that._trigger( "resizeStop", event, filteredUi( ui ) ); $.ui.dialog.overlay.resize(); } }) - .css('position', position) - .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); + .css( "position", position ) + .find( ".ui-resizable-se" ) + .addClass( "ui-icon ui-icon-grip-diagonal-se" ); }, _minHeight: function() { var options = this.options; - if (options.height === 'auto') { + if ( options.height === "auto" ) { return options.minHeight; } else { - return Math.min(options.minHeight, options.height); + return Math.min( options.minHeight, options.height ); } }, - _position: function(position) { + _position: function( position ) { var myAt = [], - offset = [0, 0], + offset = [ 0, 0 ], isVisible; - if (position) { + if ( position ) { // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( // if (typeof position == 'string' || $.isArray(position)) { // myAt = $.isArray(position) ? position : position.split(' '); - if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { - myAt = position.split ? position.split(' ') : [position[0], position[1]]; - if (myAt.length === 1) { - myAt[1] = myAt[0]; + if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) { + myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ]; + if ( myAt.length === 1 ) { + myAt[ 1 ] = myAt[ 0 ]; } - $.each(['left', 'top'], function(i, offsetPosition) { - if (+myAt[i] === myAt[i]) { - offset[i] = myAt[i]; - myAt[i] = offsetPosition; + $.each( [ "left", "top" ], function( i, offsetPosition ) { + if ( +myAt[ i ] === myAt[ i ] ) { + offset[ i ] = myAt[ i ]; + myAt[ i ] = offsetPosition; } }); position = { - my: myAt.join(" "), - at: myAt.join(" "), - offset: offset.join(" ") + my: myAt.join( " " ), + at: myAt.join( " " ), + offset: offset.join( " " ) }; - } + } - position = $.extend({}, $.ui.dialog.prototype.options.position, position); + position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); } else { position = $.ui.dialog.prototype.options.position; } // need to show the dialog to get the actual offset in the position plugin - isVisible = this.uiDialog.is(':visible'); - if (!isVisible) { + isVisible = this.uiDialog.is( ":visible" ); + if ( !isVisible ) { this.uiDialog.show(); } - this.uiDialog - // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 - .css({ top: 0, left: 0 }) - .position($.extend({ of: window }, position)); - if (!isVisible) { + this.uiDialog.position( position ); + if ( !isVisible ) { this.uiDialog.hide(); } }, _setOptions: function( options ) { - var self = this, + var that = this, resizableOptions = {}, resize = false; $.each( options, function( key, value ) { - self._setOption( key, value ); - + that._setOption( key, value ); + if ( key in sizeRelatedOptions ) { resize = true; } @@ -578,104 +547,98 @@ $.widget("ui.dialog", { } }, - _setOption: function(key, value){ - var self = this, - uiDialog = self.uiDialog; - - switch (key) { - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - case "beforeclose": - key = "beforeClose"; - break; + _setOption: function( key, value ) { + var isDraggable, isResizable, + uiDialog = this.uiDialog; + + switch ( key ) { case "buttons": - self._createButtons(value); + this._createButtons( value ); break; case "closeText": // ensure that we always pass a string - self.uiDialogTitlebarCloseText.text("" + value); + this.uiDialogTitlebarCloseText.text( "" + value ); break; case "dialogClass": uiDialog - .removeClass(self.options.dialogClass) - .addClass(uiDialogClasses + value); + .removeClass( this.options.dialogClass ) + .addClass( uiDialogClasses + value ); break; case "disabled": - if (value) { - uiDialog.addClass('ui-dialog-disabled'); + if ( value ) { + uiDialog.addClass( "ui-dialog-disabled" ); } else { - uiDialog.removeClass('ui-dialog-disabled'); + uiDialog.removeClass( "ui-dialog-disabled" ); } break; case "draggable": - var isDraggable = uiDialog.is( ":data(draggable)" ); + isDraggable = uiDialog.is( ":data(draggable)" ); if ( isDraggable && !value ) { uiDialog.draggable( "destroy" ); } - + if ( !isDraggable && value ) { - self._makeDraggable(); + this._makeDraggable(); } break; case "position": - self._position(value); + this._position( value ); break; case "resizable": // currently resizable, becoming non-resizable - var isResizable = uiDialog.is( ":data(resizable)" ); - if (isResizable && !value) { - uiDialog.resizable('destroy'); + isResizable = uiDialog.is( ":data(resizable)" ); + if ( isResizable && !value ) { + uiDialog.resizable( "destroy" ); } // currently resizable, changing handles - if (isResizable && typeof value === 'string') { - uiDialog.resizable('option', 'handles', value); + if ( isResizable && typeof value === "string" ) { + uiDialog.resizable( "option", "handles", value ); } // currently non-resizable, becoming resizable - if (!isResizable && value !== false) { - self._makeResizable(value); + if ( !isResizable && value !== false ) { + this._makeResizable( value ); } break; case "title": // convert whatever was passed in o a string, for html() to not throw up - $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); + $( ".ui-dialog-title", this.uiDialogTitlebar ) + .html( "" + ( value || " " ) ); break; } - $.Widget.prototype._setOption.apply(self, arguments); + this._super( key, value ); }, _size: function() { /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content * divs will both have width and height set, so we need to reset them */ - var options = this.options, - nonContentHeight, - minContentHeight, + var nonContentHeight, minContentHeight, autoHeight, + options = this.options, isVisible = this.uiDialog.is( ":visible" ); // reset content sizing this.element.show().css({ - width: 'auto', + width: "auto", minHeight: 0, height: 0 }); - if (options.minWidth > options.width) { + if ( options.minWidth > options.width ) { options.width = options.minWidth; } // reset wrapper sizing // determine the height of all the non-content elements nonContentHeight = this.uiDialog.css({ - height: 'auto', + height: "auto", width: options.width }) - .height(); + .outerHeight(); minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); - + if ( options.height === "auto" ) { // only needed for IE6 support if ( $.support.minHeight ) { @@ -685,7 +648,7 @@ $.widget("ui.dialog", { }); } else { this.uiDialog.show(); - var autoHeight = this.element.css( "height", "auto" ).height(); + autoHeight = this.element.css( "height", "auto" ).height(); if ( !isVisible ) { this.uiDialog.hide(); } @@ -695,102 +658,108 @@ $.widget("ui.dialog", { this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); } - if (this.uiDialog.is(':data(resizable)')) { - this.uiDialog.resizable('option', 'minHeight', this._minHeight()); + if (this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); } } }); $.extend($.ui.dialog, { - version: "1.8.16", - uuid: 0, maxZ: 0, getTitleId: function($el) { - var id = $el.attr('id'); - if (!id) { + var id = $el.attr( "id" ); + if ( !id ) { this.uuid += 1; id = this.uuid; } - return 'ui-dialog-title-' + id; + return "ui-dialog-title-" + id; }, - overlay: function(dialog) { - this.$el = $.ui.dialog.overlay.create(dialog); + overlay: function( dialog ) { + this.$el = $.ui.dialog.overlay.create( dialog ); } }); -$.extend($.ui.dialog.overlay, { +$.extend( $.ui.dialog.overlay, { instances: [], // reuse old instances due to IE memory leak with alpha transparency (see #5185) oldInstances: [], maxZ: 0, - events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), - function(event) { return event + '.dialog-overlay'; }).join(' '), - create: function(dialog) { - if (this.instances.length === 0) { + events: $.map( + "focus,mousedown,mouseup,keydown,keypress,click".split( "," ), + function( event ) { + return event + ".dialog-overlay"; + } + ).join( " " ), + create: function( dialog ) { + if ( this.instances.length === 0 ) { // prevent use of anchors and inputs // we use a setTimeout in case the overlay is created from an // event that we're going to be cancelling (see #2804) setTimeout(function() { // handle $(el).dialog().dialog('close') (see #4065) - if ($.ui.dialog.overlay.instances.length) { - $(document).bind($.ui.dialog.overlay.events, function(event) { + if ( $.ui.dialog.overlay.instances.length ) { + $( document ).bind( $.ui.dialog.overlay.events, function( event ) { // stop events if the z-index of the target is < the z-index of the overlay // we cannot return true when we don't want to cancel the event (#3523) - if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { + if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) { return false; } }); } - }, 1); - - // allow closing by pressing the escape key - $(document).bind('keydown.dialog-overlay', function(event) { - if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - dialog.close(event); - event.preventDefault(); - } - }); + }, 1 ); // handle window resize - $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); + $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize ); } - var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay')) - .appendTo(document.body) - .css({ - width: this.width(), - height: this.height() - }); + var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) ); + + // allow closing by pressing the escape key + $( document ).bind( "keydown.dialog-overlay", function( event ) { + var instances = $.ui.dialog.overlay.instances; + // only react to the event if we're the top overlay + if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el && + dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + + dialog.close( event ); + event.preventDefault(); + } + }); - if ($.fn.bgiframe) { + $el.appendTo( document.body ).css({ + width: this.width(), + height: this.height() + }); + + if ( $.fn.bgiframe ) { $el.bgiframe(); } - this.instances.push($el); + this.instances.push( $el ); return $el; }, - destroy: function($el) { - var indexOf = $.inArray($el, this.instances); - if (indexOf != -1){ - this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); + destroy: function( $el ) { + var indexOf = $.inArray( $el, this.instances ), + maxZ = 0; + + if ( indexOf !== -1 ) { + this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] ); } - if (this.instances.length === 0) { - $([document, window]).unbind('.dialog-overlay'); + if ( this.instances.length === 0 ) { + $( [ document, window ] ).unbind( ".dialog-overlay" ); } - $el.remove(); - + $el.height( 0 ).width( 0 ).remove(); + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - var maxZ = 0; - $.each(this.instances, function() { - maxZ = Math.max(maxZ, this.css('z-index')); + $.each( this.instances, function() { + maxZ = Math.max( maxZ, this.css( "z-index" ) ); }); this.maxZ = maxZ; }, @@ -798,8 +767,8 @@ $.extend($.ui.dialog.overlay, { height: function() { var scrollHeight, offsetHeight; - // handle IE 6 - if ($.browser.msie && $.browser.version < 7) { + // handle IE + if ( $.browser.msie ) { scrollHeight = Math.max( document.documentElement.scrollHeight, document.body.scrollHeight @@ -809,14 +778,14 @@ $.extend($.ui.dialog.overlay, { document.body.offsetHeight ); - if (scrollHeight < offsetHeight) { - return $(window).height() + 'px'; + if ( scrollHeight < offsetHeight ) { + return $( window ).height() + "px"; } else { - return scrollHeight + 'px'; + return scrollHeight + "px"; } // handle "good" browsers } else { - return $(document).height() + 'px'; + return $( document ).height() + "px"; } }, @@ -834,14 +803,14 @@ $.extend($.ui.dialog.overlay, { document.body.offsetWidth ); - if (scrollWidth < offsetWidth) { - return $(window).width() + 'px'; + if ( scrollWidth < offsetWidth ) { + return $( window ).width() + "px"; } else { - return scrollWidth + 'px'; + return scrollWidth + "px"; } // handle "good" browsers } else { - return $(document).width() + 'px'; + return $( document ).width() + "px"; } }, @@ -854,9 +823,9 @@ $.extend($.ui.dialog.overlay, { * This is handled by shrinking the overlay before setting it * to the full document size. */ - var $overlays = $([]); - $.each($.ui.dialog.overlay.instances, function() { - $overlays = $overlays.add(this); + var $overlays = $( [] ); + $.each( $.ui.dialog.overlay.instances, function() { + $overlays = $overlays.add( this ); }); $overlays.css({ @@ -869,10 +838,10 @@ $.extend($.ui.dialog.overlay, { } }); -$.extend($.ui.dialog.overlay.prototype, { +$.extend( $.ui.dialog.overlay.prototype, { destroy: function() { - $.ui.dialog.overlay.destroy(this.$el); + $.ui.dialog.overlay.destroy( this.$el ); } }); -}(jQuery)); +}( jQuery ) ); Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.draggable.js URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.draggable.js?rev=1401975&r1=1401974&r2=1401975&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.draggable.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.draggable.js Thu Oct 25 05:04:09 2012 @@ -1,11 +1,12 @@ -/* - * jQuery UI Draggable 1.8.16 +/*! + * jQuery UI Draggable 1.9.0 + * http://jqueryui.com * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Draggables + * http://api.jqueryui.com/draggable/ * * Depends: * jquery.ui.core.js @@ -15,6 +16,7 @@ (function( $, undefined ) { $.widget("ui.draggable", $.ui.mouse, { + version: "1.9.0", widgetEventPrefix: "drag", options: { addClasses: true, @@ -54,17 +56,9 @@ $.widget("ui.draggable", $.ui.mouse, { }, - destroy: function() { - if(!this.element.data('draggable')) return; - this.element - .removeData("draggable") - .unbind(".draggable") - .removeClass("ui-draggable" - + " ui-draggable-dragging" - + " ui-draggable-disabled"); + _destroy: function() { + this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); this._mouseDestroy(); - - return this; }, _mouseCapture: function(event) { @@ -80,17 +74,15 @@ $.widget("ui.draggable", $.ui.mouse, { if (!this.handle) return false; - if ( o.iframeFix ) { - $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { - $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') - .css({ - width: this.offsetWidth+"px", height: this.offsetHeight+"px", - position: "absolute", opacity: "0.001", zIndex: 1000 - }) - .css($(this).offset()) - .appendTo("body"); - }); - } + $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { + $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') + .css({ + width: this.offsetWidth+"px", height: this.offsetHeight+"px", + position: "absolute", opacity: "0.001", zIndex: 1000 + }) + .css($(this).offset()) + .appendTo("body"); + }); return true; @@ -103,6 +95,8 @@ $.widget("ui.draggable", $.ui.mouse, { //Create and append the visible helper this.helper = this._createHelper(event); + this.helper.addClass("ui-draggable-dragging"); + //Cache the helper size this._cacheHelperProportions(); @@ -163,7 +157,7 @@ $.widget("ui.draggable", $.ui.mouse, { if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, event); - this.helper.addClass("ui-draggable-dragging"); + this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) @@ -208,15 +202,21 @@ $.widget("ui.draggable", $.ui.mouse, { this.dropped = false; } - //if the original element is removed, don't bother to continue if helper is set to "original" - if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original") + //if the original element is no longer in the DOM don't bother to continue (see #8269) + var element = this.element[0], elementInDom = false; + while ( element && (element = element.parentNode) ) { + if (element == document ) { + elementInDom = true; + } + } + if ( !elementInDom && this.options.helper === "original" ) return false; if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { - var self = this; + var that = this; $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { - if(self._trigger("stop", event) !== false) { - self._clear(); + if(that._trigger("stop", event) !== false) { + that._clear(); } }); } else { @@ -229,11 +229,10 @@ $.widget("ui.draggable", $.ui.mouse, { }, _mouseUp: function(event) { - if (this.options.iframeFix === true) { - $("div.ui-draggable-iframeFix").each(function() { - this.parentNode.removeChild(this); - }); //Remove frame helpers - } + //Remove frame helpers + $("div.ui-draggable-iframeFix").each(function() { + this.parentNode.removeChild(this); + }); //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); @@ -313,7 +312,7 @@ $.widget("ui.draggable", $.ui.mouse, { // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { po.left += this.scrollParent.scrollLeft(); po.top += this.scrollParent.scrollTop(); } @@ -371,7 +370,7 @@ $.widget("ui.draggable", $.ui.mouse, { ]; if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { - var c = $(o.containment); + var c = $(o.containment); var ce = c[0]; if(!ce) return; var co = c.offset(); var over = ($(ce).css("overflow") != 'hidden'); @@ -394,20 +393,20 @@ $.widget("ui.draggable", $.ui.mouse, { if(!pos) pos = this.position; var mod = d == "absolute" ? 1 : -1; - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); return { top: ( pos.top // The absolute mouse position + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) ), left: ( pos.left // The absolute mouse position + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) ) }; @@ -415,7 +414,7 @@ $.widget("ui.draggable", $.ui.mouse, { _generatePosition: function(event) { - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); var pageX = event.pageX; var pageY = event.pageY; @@ -425,18 +424,18 @@ $.widget("ui.draggable", $.ui.mouse, { */ if(this.originalPosition) { //If we are not dragging yet, we won't check for options - var containment; - if(this.containment) { - if (this.relative_container){ - var co = this.relative_container.offset(); - containment = [ this.containment[0] + co.left, - this.containment[1] + co.top, - this.containment[2] + co.left, - this.containment[3] + co.top ]; - } - else { - containment = this.containment; - } + var containment; + if(this.containment) { + if (this.relative_container){ + var co = this.relative_container.offset(); + containment = [ this.containment[0] + co.left, + this.containment[1] + co.top, + this.containment[2] + co.left, + this.containment[3] + co.top ]; + } + else { + containment = this.containment; + } if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; @@ -461,14 +460,14 @@ $.widget("ui.draggable", $.ui.mouse, { - this.offset.click.top // Click offset (relative to the element) - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.top // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) ), left: ( pageX // The absolute mouse position - this.offset.click.left // Click offset (relative to the element) - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.left // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) ) }; @@ -504,10 +503,6 @@ $.widget("ui.draggable", $.ui.mouse, { }); -$.extend($.ui.draggable, { - version: "1.8.16" -}); - $.ui.plugin.add("draggable", "connectToSortable", { start: function(event, ui) { @@ -563,7 +558,7 @@ $.ui.plugin.add("draggable", "connectToS }, drag: function(event, ui) { - var inst = $(this).data("draggable"), self = this; + var inst = $(this).data("draggable"), that = this; var checkPos = function(o) { var dyClick = this.offset.click.top, dxClick = this.offset.click.left; @@ -590,7 +585,7 @@ $.ui.plugin.add("draggable", "connectToS //Now we fake the start of dragging for the sortable instance, //by cloning the list group item, appending it to the sortable and using it as inst.currentItem //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) - this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); + this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it this.instance.options.helper = function() { return ui.helper[0]; }; Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.droppable.js URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.droppable.js?rev=1401975&r1=1401974&r2=1401975&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.droppable.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.droppable.js Thu Oct 25 05:04:09 2012 @@ -1,11 +1,12 @@ -/* - * jQuery UI Droppable 1.8.16 +/*! + * jQuery UI Droppable 1.9.0 + * http://jqueryui.com * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Droppables + * http://api.jqueryui.com/droppable/ * * Depends: * jquery.ui.core.js @@ -16,6 +17,7 @@ (function( $, undefined ) { $.widget("ui.droppable", { + version: "1.9.0", widgetEventPrefix: "drop", options: { accept: '*', @@ -46,18 +48,13 @@ $.widget("ui.droppable", { }, - destroy: function() { + _destroy: function() { var drop = $.ui.ddmanager.droppables[this.options.scope]; for ( var i = 0; i < drop.length; i++ ) if ( drop[i] == this ) drop.splice(i, 1); - this.element - .removeClass("ui-droppable ui-droppable-disabled") - .removeData("droppable") - .unbind(".droppable"); - - return this; + this.element.removeClass("ui-droppable ui-droppable-disabled"); }, _setOption: function(key, value) { @@ -146,10 +143,6 @@ $.widget("ui.droppable", { }); -$.extend($.ui.droppable, { - version: "1.8.16" -}); - $.ui.intersect = function(draggable, droppable, toleranceMode) { if (!droppable.offset) return false; @@ -227,7 +220,7 @@ $.ui.ddmanager = { if(!this.options) return; if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) - dropped = dropped || this._drop.call(this, event); + dropped = this._drop.call(this, event) || dropped; if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { this.isout = 1; this.isover = 0; @@ -240,7 +233,7 @@ $.ui.ddmanager = { }, dragStart: function( draggable, event ) { //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) - draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() { + draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); }); }, @@ -260,7 +253,12 @@ $.ui.ddmanager = { var parentInstance; if (this.options.greedy) { - var parent = this.element.parents(':data(droppable):eq(0)'); + // find droppable parents with same scope + var scope = this.options.scope; + var parent = this.element.parents(':data(droppable)').filter(function () { + return $.data(this, 'droppable').options.scope === scope; + }); + if (parent.length) { parentInstance = $.data(parent[0], 'droppable'); parentInstance.greedyChild = (c == 'isover' ? 1 : 0); @@ -287,7 +285,7 @@ $.ui.ddmanager = { }, dragStop: function( draggable, event ) { - draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" ); + draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); } Modified: ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.mouse.js URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.mouse.js?rev=1401975&r1=1401974&r2=1401975&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.mouse.js (original) +++ ofbiz/branches/20120329_portletWidget/framework/images/webapp/images/jquery/ui/development-bundle/ui/jquery.ui.mouse.js Thu Oct 25 05:04:09 2012 @@ -1,11 +1,12 @@ /*! - * jQuery UI Mouse 1.8.16 + * jQuery UI Mouse 1.9.0 + * http://jqueryui.com * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Mouse + * http://api.jqueryui.com/mouse/ * * Depends: * jquery.ui.widget.js @@ -18,21 +19,22 @@ $( document ).mouseup( function( e ) { }); $.widget("ui.mouse", { + version: "1.9.0", options: { - cancel: ':input,option', + cancel: 'input,textarea,button,select,option', distance: 1, delay: 0 }, _mouseInit: function() { - var self = this; + var that = this; this.element .bind('mousedown.'+this.widgetName, function(event) { - return self._mouseDown(event); + return that._mouseDown(event); }) .bind('click.'+this.widgetName, function(event) { - if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) { - $.removeData(event.target, self.widgetName + '.preventClickEvent'); + if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) { + $.removeData(event.target, that.widgetName + '.preventClickEvent'); event.stopImmediatePropagation(); return false; } @@ -45,22 +47,27 @@ $.widget("ui.mouse", { // other instances of mouse _mouseDestroy: function() { this.element.unbind('.'+this.widgetName); + if ( this._mouseMoveDelegate ) { + $(document) + .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) + .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); + } }, _mouseDown: function(event) { // don't let more than one widget handle mouseStart - if( mouseHandled ) { return }; + if( mouseHandled ) { return; } // we may have missed mouseup (out of window) (this._mouseStarted && this._mouseUp(event)); this._mouseDownEvent = event; - var self = this, - btnIsLeft = (event.which == 1), + var that = this, + btnIsLeft = (event.which === 1), // event.target.nodeName works around a bug in IE 8 with // disabled inputs (#7620) - elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); + elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true; } @@ -68,7 +75,7 @@ $.widget("ui.mouse", { this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { - self.mouseDelayMet = true; + that.mouseDelayMet = true; }, this.options.delay); } @@ -87,10 +94,10 @@ $.widget("ui.mouse", { // these delegates are required to keep context this._mouseMoveDelegate = function(event) { - return self._mouseMove(event); + return that._mouseMove(event); }; this._mouseUpDelegate = function(event) { - return self._mouseUp(event); + return that._mouseUp(event); }; $(document) .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) @@ -130,8 +137,8 @@ $.widget("ui.mouse", { if (this._mouseStarted) { this._mouseStarted = false; - if (event.target == this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + '.preventClickEvent', true); + if (event.target === this._mouseDownEvent.target) { + $.data(event.target, this.widgetName + '.preventClickEvent', true); } this._mouseStop(event); |
| Free forum by Nabble | Edit this page |
