summaryrefslogtreecommitdiff
path: root/lib/scripts/jquery/jquery-ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/jquery/jquery-ui.js')
-rw-r--r--lib/scripts/jquery/jquery-ui.js1823
1 files changed, 1145 insertions, 678 deletions
diff --git a/lib/scripts/jquery/jquery-ui.js b/lib/scripts/jquery/jquery-ui.js
index 670e39a8f..31ee9cd81 100644
--- a/lib/scripts/jquery/jquery-ui.js
+++ b/lib/scripts/jquery/jquery-ui.js
@@ -1,7 +1,7 @@
-/*! jQuery UI - v1.11.0 - 2014-06-26
+/*! jQuery UI - v1.11.4 - 2015-03-11
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
-* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
+* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
@@ -15,10 +15,10 @@
}
}(function( $ ) {
/*!
- * jQuery UI Core 1.11.0
+ * jQuery UI Core 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -30,7 +30,7 @@
$.ui = $.ui || {};
$.extend( $.ui, {
- version: "1.11.0",
+ version: "1.11.4",
keyCode: {
BACKSPACE: 8,
@@ -54,15 +54,16 @@ $.extend( $.ui, {
// plugins
$.fn.extend({
- scrollParent: function() {
+ scrollParent: function( includeHidden ) {
var position = this.css( "position" ),
excludeStaticParent = position === "absolute",
+ overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
scrollParent = this.parents().filter( function() {
var parent = $( this );
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
return false;
}
- return (/(auto|scroll)/).test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
+ return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
}).eq( 0 );
return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
@@ -99,10 +100,10 @@ function focusable( element, isTabIndexNotNaN ) {
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
- img = $( "img[usemap=#" + mapName + "]" )[0];
+ img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
return !!img && visible( img );
}
- return ( /input|select|textarea|button|object/.test( nodeName ) ?
+ return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
!element.disabled :
"a" === nodeName ?
element.href || isTabIndexNotNaN :
@@ -308,10 +309,10 @@ $.ui.plugin = {
/*!
- * jQuery UI Widget 1.11.0
+ * jQuery UI Widget 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -324,11 +325,18 @@ var widget_uuid = 0,
$.cleanData = (function( orig ) {
return function( elems ) {
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ var events, elem, i;
+ for ( i = 0; (elem = elems[i]) != null; i++ ) {
try {
- $( elem ).triggerHandler( "remove" );
+
+ // Only trigger remove when necessary to save time
+ events = $._data( elem, "events" );
+ if ( events && events.remove ) {
+ $( elem ).triggerHandler( "remove" );
+ }
+
// http://bugs.jquery.com/ticket/8235
- } catch( e ) {}
+ } catch ( e ) {}
}
orig( elems );
};
@@ -482,11 +490,6 @@ $.widget.bridge = function( name, object ) {
args = widget_slice.call( arguments, 1 ),
returnValue = this;
- // allow multiple hashes to be passed on init
- options = !isMethodCall && args.length ?
- $.widget.extend.apply( null, [ options ].concat(args) ) :
- options;
-
if ( isMethodCall ) {
this.each(function() {
var methodValue,
@@ -511,6 +514,12 @@ $.widget.bridge = function( name, object ) {
}
});
} else {
+
+ // Allow multiple hashes to be passed on init
+ if ( args.length ) {
+ options = $.widget.extend.apply( null, [ options ].concat(args) );
+ }
+
this.each(function() {
var instance = $.data( this, fullName );
if ( instance ) {
@@ -546,10 +555,6 @@ $.Widget.prototype = {
this.element = $( element );
this.uuid = widget_uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
- this.options = $.widget.extend( {},
- this.options,
- this._getCreateOptions(),
- options );
this.bindings = $();
this.hoverable = $();
@@ -572,6 +577,11 @@ $.Widget.prototype = {
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}
+ this.options = $.widget.extend( {},
+ this.options,
+ this._getCreateOptions(),
+ options );
+
this._create();
this._trigger( "create", null, this._getCreateEventData() );
this._init();
@@ -734,8 +744,14 @@ $.Widget.prototype = {
},
_off: function( element, eventName ) {
- eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
+ this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
+
+ // Clear the stack to avoid memory leaks (#10056)
+ this.bindings = $( this.bindings.not( element ).get() );
+ this.focusable = $( this.focusable.not( element ).get() );
+ this.hoverable = $( this.hoverable.not( element ).get() );
},
_delay: function( handler, delay ) {
@@ -841,10 +857,10 @@ var widget = $.widget;
/*!
- * jQuery UI Mouse 1.11.0
+ * jQuery UI Mouse 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -858,7 +874,7 @@ $( document ).mouseup( function() {
});
var mouse = $.widget("ui.mouse", {
- version: "1.11.0",
+ version: "1.11.4",
options: {
cancel: "input,textarea,button,select,option",
distance: 1,
@@ -899,6 +915,8 @@ var mouse = $.widget("ui.mouse", {
return;
}
+ this._mouseMoved = false;
+
// we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event));
@@ -952,13 +970,23 @@ var mouse = $.widget("ui.mouse", {
},
_mouseMove: function(event) {
- // IE mouseup check - mouseup happened when mouse was out of window
- if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
- return this._mouseUp(event);
+ // Only check for mouseups outside the document if you've moved inside the document
+ // at least once. This prevents the firing of mouseup in the case of IE<9, which will
+ // fire a mousemove event if content is placed under the cursor. See #7778
+ // Support: IE <9
+ if ( this._mouseMoved ) {
+ // IE mouseup check - mouseup happened when mouse was out of window
+ if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
+ return this._mouseUp(event);
+
+ // Iframe mouseup check - mouseup occurred in another document
+ } else if ( !event.which ) {
+ return this._mouseUp( event );
+ }
+ }
- // Iframe mouseup check - mouseup occurred in another document
- } else if ( !event.which ) {
- return this._mouseUp( event );
+ if ( event.which || event.button ) {
+ this._mouseMoved = true;
}
if (this._mouseStarted) {
@@ -1015,10 +1043,10 @@ var mouse = $.widget("ui.mouse", {
/*!
- * jQuery UI Position 1.11.0
+ * jQuery UI Position 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -1129,8 +1157,11 @@ $.position = {
offset: withinElement.offset() || { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
- width: isWindow ? withinElement.width() : withinElement.outerWidth(),
- height: isWindow ? withinElement.height() : withinElement.outerHeight()
+
+ // support: jQuery 1.6.x
+ // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
+ width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
+ height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
};
}
};
@@ -1451,12 +1482,12 @@ $.ui.position = {
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
- if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
+ if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
position.top += myOffset + atOffset + offset;
}
} else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
- if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
+ if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
position.top += myOffset + atOffset + offset;
}
}
@@ -1519,10 +1550,10 @@ var position = $.ui.position;
/*!
- * jQuery UI Accordion 1.11.0
+ * jQuery UI Accordion 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -1531,7 +1562,7 @@ var position = $.ui.position;
var accordion = $.widget( "ui.accordion", {
- version: "1.11.0",
+ version: "1.11.4",
options: {
active: 0,
animate: {},
@@ -1765,13 +1796,22 @@ var accordion = $.widget( "ui.accordion", {
},
_processPanels: function() {
+ var prevHeaders = this.headers,
+ prevPanels = this.panels;
+
this.headers = this.element.find( this.options.header )
.addClass( "ui-accordion-header ui-state-default ui-corner-all" );
- this.headers.next()
+ this.panels = this.headers.next()
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
.filter( ":not(.ui-accordion-content-active)" )
.hide();
+
+ // Avoid memory leaks (#10056)
+ if ( prevPanels ) {
+ this._off( prevHeaders.not( this.headers ) );
+ this._off( prevPanels.not( this.panels ) );
+ }
},
_refresh: function() {
@@ -1980,7 +2020,10 @@ var accordion = $.widget( "ui.accordion", {
toHide.attr({
"aria-hidden": "true"
});
- toHide.prev().attr( "aria-selected", "false" );
+ toHide.prev().attr({
+ "aria-selected": "false",
+ "aria-expanded": "false"
+ });
// if we're switching panels, remove the old header from the tab order
// if we're opening from collapsed state, remove the previous header from the tab order
// if we're collapsing, then keep the collapsing header in the tab order
@@ -1991,7 +2034,7 @@ var accordion = $.widget( "ui.accordion", {
});
} else if ( toShow.length ) {
this.headers.filter(function() {
- return $( this ).attr( "tabIndex" ) === 0;
+ return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
})
.attr( "tabIndex", -1 );
}
@@ -2001,8 +2044,8 @@ var accordion = $.widget( "ui.accordion", {
.prev()
.attr({
"aria-selected": "true",
- tabIndex: 0,
- "aria-expanded": "true"
+ "aria-expanded": "true",
+ tabIndex: 0
});
},
@@ -2010,6 +2053,7 @@ var accordion = $.widget( "ui.accordion", {
var total, easing, duration,
that = this,
adjust = 0,
+ boxSizing = toShow.css( "box-sizing" ),
down = toShow.length &&
( !toHide.length || ( toShow.index() < toHide.index() ) ),
animate = this.options.animate || {},
@@ -2052,7 +2096,9 @@ var accordion = $.widget( "ui.accordion", {
step: function( now, fx ) {
fx.now = Math.round( now );
if ( fx.prop !== "height" ) {
- adjust += fx.now;
+ if ( boxSizing === "content-box" ) {
+ adjust += fx.now;
+ }
} else if ( that.options.heightStyle !== "content" ) {
fx.now = Math.round( total - toHide.outerHeight() - adjust );
adjust = 0;
@@ -2080,10 +2126,10 @@ var accordion = $.widget( "ui.accordion", {
/*!
- * jQuery UI Menu 1.11.0
+ * jQuery UI Menu 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -2092,7 +2138,7 @@ var accordion = $.widget( "ui.accordion", {
var menu = $.widget( "ui.menu", {
- version: "1.11.0",
+ version: "1.11.4",
defaultElement: "<ul>",
delay: 300,
options: {
@@ -2167,6 +2213,12 @@ var menu = $.widget( "ui.menu", {
}
},
"mouseenter .ui-menu-item": function( event ) {
+ // Ignore mouse events while typeahead is active, see #10458.
+ // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
+ // is over an item in the menu
+ if ( this.previousFilter ) {
+ return;
+ }
var target = $( event.currentTarget );
// Remove ui-state-active class from siblings of the newly focused menu item
// to avoid a jump caused by adjacent elements both having a class with a border
@@ -2246,13 +2298,9 @@ var menu = $.widget( "ui.menu", {
},
_keydown: function( event ) {
- var match, prev, character, skip, regex,
+ var match, prev, character, skip,
preventDefault = true;
- function escape( value ) {
- return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
- }
-
switch ( event.keyCode ) {
case $.ui.keyCode.PAGE_UP:
this.previousPage( event );
@@ -2301,10 +2349,7 @@ var menu = $.widget( "ui.menu", {
character = prev + character;
}
- regex = new RegExp( "^" + escape( character ), "i" );
- match = this.activeMenu.find( this.options.items ).filter(function() {
- return regex.test( $( this ).text() );
- });
+ match = this._filterMenuItems( character );
match = skip && match.index( this.active.next() ) !== -1 ?
this.active.nextAll( ".ui-menu-item" ) :
match;
@@ -2313,22 +2358,15 @@ var menu = $.widget( "ui.menu", {
// to move down the menu to the first item that starts with that character
if ( !match.length ) {
character = String.fromCharCode( event.keyCode );
- regex = new RegExp( "^" + escape( character ), "i" );
- match = this.activeMenu.find( this.options.items ).filter(function() {
- return regex.test( $( this ).text() );
- });
+ match = this._filterMenuItems( character );
}
if ( match.length ) {
this.focus( event, match );
- if ( match.length > 1 ) {
- this.previousFilter = character;
- this.filterTimer = this._delay(function() {
- delete this.previousFilter;
- }, 1000 );
- } else {
+ this.previousFilter = character;
+ this.filterTimer = this._delay(function() {
delete this.previousFilter;
- }
+ }, 1000 );
} else {
delete this.previousFilter;
}
@@ -2700,15 +2738,29 @@ var menu = $.widget( "ui.menu", {
this.collapseAll( event, true );
}
this._trigger( "select", event, ui );
+ },
+
+ _filterMenuItems: function(character) {
+ var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
+ regex = new RegExp( "^" + escapedCharacter, "i" );
+
+ return this.activeMenu
+ .find( this.options.items )
+
+ // Only match on items, not dividers or other content (#10571)
+ .filter( ".ui-menu-item" )
+ .filter(function() {
+ return regex.test( $.trim( $( this ).text() ) );
+ });
}
});
/*!
- * jQuery UI Autocomplete 1.11.0
+ * jQuery UI Autocomplete 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -2717,7 +2769,7 @@ var menu = $.widget( "ui.menu", {
$.widget( "ui.autocomplete", {
- version: "1.11.0",
+ version: "1.11.4",
defaultElement: "<input>",
options: {
appendTo: null,
@@ -2820,7 +2872,9 @@ $.widget( "ui.autocomplete", {
break;
case keyCode.ESCAPE:
if ( this.menu.element.is( ":visible" ) ) {
- this._value( this.term );
+ if ( !this.isMultiLine ) {
+ this._value( this.term );
+ }
this.close( event );
// Different browsers have different default behavior for escape
// Single press can mean undo or clear
@@ -2956,7 +3010,7 @@ $.widget( "ui.autocomplete", {
// Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value;
- if ( label && jQuery.trim( label ).length ) {
+ if ( label && $.trim( label ).length ) {
this.liveRegion.children().hide();
$( "<div>" ).text( label ).appendTo( this.liveRegion );
}
@@ -3315,10 +3369,10 @@ var autocomplete = $.ui.autocomplete;
/*!
- * jQuery UI Button 1.11.0
+ * jQuery UI Button 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -3354,7 +3408,7 @@ var lastActive,
};
$.widget( "ui.button", {
- version: "1.11.0",
+ version: "1.11.4",
defaultElement: "<button>",
options: {
disabled: null,
@@ -3650,7 +3704,7 @@ $.widget( "ui.button", {
});
$.widget( "ui.buttonset", {
- version: "1.11.0",
+ version: "1.11.4",
options: {
items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
},
@@ -3712,10 +3766,10 @@ var button = $.ui.button;
/*!
- * jQuery UI Datepicker 1.11.0
+ * jQuery UI Datepicker 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -3723,7 +3777,7 @@ var button = $.ui.button;
*/
-$.extend($.ui, { datepicker: { version: "1.11.0" } });
+$.extend($.ui, { datepicker: { version: "1.11.4" } });
var datepicker_instActive;
@@ -4089,6 +4143,10 @@ $.extend(Datepicker.prototype, {
} else if (nodeName === "div" || nodeName === "span") {
$target.removeClass(this.markerClassName).empty();
}
+
+ if ( datepicker_instActive === inst ) {
+ datepicker_instActive = null;
+ }
},
/* Enable the date picker to a jQuery selection.
@@ -4499,12 +4557,16 @@ $.extend(Datepicker.prototype, {
datepicker_instActive = inst; // for delegate hover events
inst.dpDiv.empty().append(this._generateHTML(inst));
this._attachHandlers(inst);
- inst.dpDiv.find("." + this._dayOverClass + " a");
var origyearshtml,
numMonths = this._getNumberOfMonths(inst),
cols = numMonths[1],
- width = 17;
+ width = 17,
+ activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
+
+ if ( activeCell.length > 0 ) {
+ datepicker_handleMouseover.apply( activeCell.get( 0 ) );
+ }
inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
if (cols > 1) {
@@ -4838,7 +4900,8 @@ $.extend(Datepicker.prototype, {
var isDoubled = lookAhead(match),
size = (match === "@" ? 14 : (match === "!" ? 20 :
(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
- digits = new RegExp("^\\d{1," + size + "}"),
+ minSize = (match === "y" ? size : 1),
+ digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
num = value.substring(iValue).match(digits);
if (!num) {
throw "Missing number at position " + iValue;
@@ -5699,18 +5762,20 @@ function datepicker_bindHover(dpDiv) {
$(this).removeClass("ui-datepicker-next-hover");
}
})
- .delegate(selector, "mouseover", function(){
- if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? dpDiv.parent()[0] : datepicker_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");
- }
- }
- });
+ .delegate( selector, "mouseover", datepicker_handleMouseover );
+}
+
+function datepicker_handleMouseover() {
+ if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_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");
+ }
+ }
}
/* jQuery extend now ignores nulls! */
@@ -5766,16 +5831,16 @@ $.fn.datepicker = function(options){
$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
-$.datepicker.version = "1.11.0";
+$.datepicker.version = "1.11.4";
var datepicker = $.datepicker;
/*!
- * jQuery UI Draggable 1.11.0
+ * jQuery UI Draggable 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -5784,7 +5849,7 @@ var datepicker = $.datepicker;
$.widget("ui.draggable", $.ui.mouse, {
- version: "1.11.0",
+ version: "1.11.4",
widgetEventPrefix: "drag",
options: {
addClasses: true,
@@ -5819,8 +5884,8 @@ $.widget("ui.draggable", $.ui.mouse, {
},
_create: function() {
- if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) {
- this.element[0].style.position = "relative";
+ if ( this.options.helper === "original" ) {
+ this._setPositionRelative();
}
if (this.options.addClasses){
this.element.addClass("ui-draggable");
@@ -5836,6 +5901,7 @@ $.widget("ui.draggable", $.ui.mouse, {
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "handle" ) {
+ this._removeHandleClassName();
this._setHandleClassName();
}
},
@@ -5851,20 +5917,9 @@ $.widget("ui.draggable", $.ui.mouse, {
},
_mouseCapture: function(event) {
+ var o = this.options;
- var document = this.document[ 0 ],
- o = this.options;
-
- // support: IE9
- // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
- try {
- // Support: IE9+
- // If the <body> is blurred, IE will switch windows, see #9520
- if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
- // Blur any element that currently has focus, see #4261
- $( document.activeElement ).blur();
- }
- } catch ( error ) {}
+ this._blurActiveElement( event );
// among others, prevent a drag on a resizable-handle
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
@@ -5877,20 +5932,54 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
}
- $(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");
- });
+ this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
return true;
},
+ _blockFrames: function( selector ) {
+ this.iframeBlocks = this.document.find( selector ).map(function() {
+ var iframe = $( this );
+
+ return $( "<div>" )
+ .css( "position", "absolute" )
+ .appendTo( iframe.parent() )
+ .outerWidth( iframe.outerWidth() )
+ .outerHeight( iframe.outerHeight() )
+ .offset( iframe.offset() )[ 0 ];
+ });
+ },
+
+ _unblockFrames: function() {
+ if ( this.iframeBlocks ) {
+ this.iframeBlocks.remove();
+ delete this.iframeBlocks;
+ }
+ },
+
+ _blurActiveElement: function( event ) {
+ var document = this.document[ 0 ];
+
+ // Only need to blur if the event occurred on the draggable itself, see #10527
+ if ( !this.handleElement.is( event.target ) ) {
+ return;
+ }
+
+ // support: IE9
+ // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
+ try {
+
+ // Support: IE9, IE10
+ // If the <body> is blurred, IE will switch windows, see #9520
+ if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
+
+ // Blur any element that currently has focus, see #4261
+ $( document.activeElement ).blur();
+ }
+ } catch ( error ) {}
+ },
+
_mouseStart: function(event) {
var o = this.options;
@@ -5918,28 +6007,15 @@ $.widget("ui.draggable", $.ui.mouse, {
//Store the helper's css position
this.cssPosition = this.helper.css( "position" );
- this.scrollParent = this.helper.scrollParent();
+ this.scrollParent = this.helper.scrollParent( true );
this.offsetParent = this.helper.offsetParent();
- this.offsetParentCssPosition = this.offsetParent.css( "position" );
+ this.hasFixedAncestor = this.helper.parents().filter(function() {
+ return $( this ).css( "position" ) === "fixed";
+ }).length > 0;
//The element's absolute position on the page minus margins
- this.offset = this.positionAbs = this.element.offset();
- this.offset = {
- top: this.offset.top - this.margins.top,
- left: this.offset.left - this.margins.left
- };
-
- //Reset scroll cache
- this.offset.scroll = false;
-
- $.extend(this.offset, {
- click: { //Where the click happened, relative to the element
- left: event.pageX - this.offset.left,
- top: event.pageY - this.offset.top
- },
- parent: this._getParentOffset(),
- relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
- });
+ this.positionAbs = this.element.offset();
+ this._refreshOffsets( event );
//Generate the original position
this.originalPosition = this.position = this._generatePosition( event, false );
@@ -5966,6 +6042,10 @@ $.widget("ui.draggable", $.ui.mouse, {
$.ui.ddmanager.prepareOffsets(this, event);
}
+ // Reset helper's right/bottom css if they're set and set explicit width/height instead
+ // as this prevents resizing of elements with right/bottom set (see #7772)
+ this._normalizeRightBottom();
+
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)
@@ -5976,9 +6056,24 @@ $.widget("ui.draggable", $.ui.mouse, {
return true;
},
+ _refreshOffsets: function( event ) {
+ this.offset = {
+ top: this.positionAbs.top - this.margins.top,
+ left: this.positionAbs.left - this.margins.left,
+ scroll: false,
+ parent: this._getParentOffset(),
+ relative: this._getRelativeOffset()
+ };
+
+ this.offset.click = {
+ left: event.pageX - this.offset.left,
+ top: event.pageY - this.offset.top
+ };
+ },
+
_mouseDrag: function(event, noPropagation) {
// reset any necessary cached properties (see #5009)
- if ( this.offsetParentCssPosition === "fixed" ) {
+ if ( this.hasFixedAncestor ) {
this.offset.parent = this._getParentOffset();
}
@@ -6036,19 +6131,19 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
},
- _mouseUp: function(event) {
- //Remove frame helpers
- $("div.ui-draggable-iframeFix").each(function() {
- this.parentNode.removeChild(this);
- });
+ _mouseUp: function( event ) {
+ this._unblockFrames();
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if ( $.ui.ddmanager ) {
$.ui.ddmanager.dragStop(this, event);
}
- // The interaction is over; whether or not the click resulted in a drag, focus the element
- this.element.focus();
+ // Only need to focus if the event occurred on the draggable itself, see #10527
+ if ( this.handleElement.is( event.target ) ) {
+ // The interaction is over; whether or not the click resulted in a drag, focus the element
+ this.element.focus();
+ }
return $.ui.mouse.prototype._mouseUp.call(this, event);
},
@@ -6072,25 +6167,36 @@ $.widget("ui.draggable", $.ui.mouse, {
},
_setHandleClassName: function() {
- this._removeHandleClassName();
- $( this.options.handle || this.element ).addClass( "ui-draggable-handle" );
+ this.handleElement = this.options.handle ?
+ this.element.find( this.options.handle ) : this.element;
+ this.handleElement.addClass( "ui-draggable-handle" );
},
_removeHandleClassName: function() {
- this.element.find( ".ui-draggable-handle" )
- .addBack()
- .removeClass( "ui-draggable-handle" );
+ this.handleElement.removeClass( "ui-draggable-handle" );
},
_createHelper: function(event) {
var o = this.options,
- helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[ 0 ], [ event ])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
+ helperIsFunction = $.isFunction( o.helper ),
+ helper = helperIsFunction ?
+ $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
+ ( o.helper === "clone" ?
+ this.element.clone().removeAttr( "id" ) :
+ this.element );
if (!helper.parents("body").length) {
helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
}
+ // http://bugs.jqueryui.com/ticket/9446
+ // a helper function can return the original element
+ // which wouldn't have been set to relative in _create
+ if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
+ this._setPositionRelative();
+ }
+
if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
helper.css("position", "absolute");
}
@@ -6099,6 +6205,12 @@ $.widget("ui.draggable", $.ui.mouse, {
},
+ _setPositionRelative: function() {
+ if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
+ this.element[ 0 ].style.position = "relative";
+ }
+ },
+
_adjustOffsetFromHelper: function(obj) {
if (typeof obj === "string") {
obj = obj.split(" ");
@@ -6144,8 +6256,8 @@ $.widget("ui.draggable", $.ui.mouse, {
}
return {
- top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
- left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
};
},
@@ -6167,10 +6279,10 @@ $.widget("ui.draggable", $.ui.mouse, {
_cacheMargins: function() {
this.margins = {
- left: (parseInt(this.element.css("marginLeft"),10) || 0),
- top: (parseInt(this.element.css("marginTop"),10) || 0),
- right: (parseInt(this.element.css("marginRight"),10) || 0),
- bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
+ left: (parseInt(this.element.css("marginLeft"), 10) || 0),
+ top: (parseInt(this.element.css("marginTop"), 10) || 0),
+ right: (parseInt(this.element.css("marginRight"), 10) || 0),
+ bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
};
},
@@ -6183,11 +6295,11 @@ $.widget("ui.draggable", $.ui.mouse, {
_setContainment: function() {
- var over, c, ce,
+ var isUserScrollable, c, ce,
o = this.options,
document = this.document[ 0 ];
- this.relative_container = null;
+ this.relativeContainer = null;
if ( !o.containment ) {
this.containment = null;
@@ -6230,15 +6342,25 @@ $.widget("ui.draggable", $.ui.mouse, {
return;
}
- over = c.css( "overflow" ) !== "hidden";
+ isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
this.containment = [
( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
- ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right,
- ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top - this.margins.bottom
+ ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
+ ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
+ ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
+ this.helperProportions.width -
+ this.margins.left -
+ this.margins.right,
+ ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
+ ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
+ ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
+ this.helperProportions.height -
+ this.margins.top -
+ this.margins.bottom
];
- this.relative_container = c;
+ this.relativeContainer = c;
},
_convertPositionTo: function(d, pos) {
@@ -6291,8 +6413,8 @@ $.widget("ui.draggable", $.ui.mouse, {
// If we are not dragging yet, we won't check for options
if ( constrainPosition ) {
if ( this.containment ) {
- if ( this.relative_container ){
- co = this.relative_container.offset();
+ if ( this.relativeContainer ){
+ co = this.relativeContainer.offset();
containment = [
this.containment[ 0 ] + co.left,
this.containment[ 1 ] + co.top,
@@ -6366,16 +6488,29 @@ $.widget("ui.draggable", $.ui.mouse, {
}
},
+ _normalizeRightBottom: function() {
+ if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
+ this.helper.width( this.helper.width() );
+ this.helper.css( "right", "auto" );
+ }
+ if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
+ this.helper.height( this.helper.height() );
+ this.helper.css( "bottom", "auto" );
+ }
+ },
+
// From now on bulk stuff - mainly helpers
- _trigger: function(type, event, ui) {
+ _trigger: function( type, event, ui ) {
ui = ui || this._uiHash();
$.ui.plugin.call( this, type, [ event, ui, this ], true );
- //The absolute position has to be recalculated after plugins
- if (type === "drag") {
- this.positionAbs = this._convertPositionTo("absolute");
+
+ // Absolute position and offset (see #6884 ) have to be recalculated after plugins
+ if ( /^(drag|start|stop)/.test( type ) ) {
+ this.positionAbs = this._convertPositionTo( "absolute" );
+ ui.offset = this.positionAbs;
}
- return $.Widget.prototype._trigger.call(this, type, event, ui);
+ return $.Widget.prototype._trigger.call( this, type, event, ui );
},
plugins: {},
@@ -6391,160 +6526,201 @@ $.widget("ui.draggable", $.ui.mouse, {
});
-$.ui.plugin.add("draggable", "connectToSortable", {
- start: function( event, ui, inst ) {
+$.ui.plugin.add( "draggable", "connectToSortable", {
+ start: function( event, ui, draggable ) {
+ var uiSortable = $.extend( {}, ui, {
+ item: draggable.element
+ });
- var o = inst.options,
- uiSortable = $.extend({}, ui, { item: inst.element });
- inst.sortables = [];
- $(o.connectToSortable).each(function() {
+ draggable.sortables = [];
+ $( draggable.options.connectToSortable ).each(function() {
var sortable = $( this ).sortable( "instance" );
- if (sortable && !sortable.options.disabled) {
- inst.sortables.push({
- instance: sortable,
- shouldRevert: sortable.options.revert
- });
- 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).
+
+ if ( sortable && !sortable.options.disabled ) {
+ draggable.sortables.push( sortable );
+
+ // refreshPositions is called at drag start to refresh the containerCache
+ // which is used in drag. This ensures it's initialized and synchronized
+ // with any changes that might have happened on the page since initialization.
+ sortable.refreshPositions();
sortable._trigger("activate", event, uiSortable);
}
});
-
},
- stop: function( event, ui, inst ) {
-
- //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
+ stop: function( event, ui, draggable ) {
var uiSortable = $.extend( {}, ui, {
- item: inst.element
+ item: draggable.element
});
- $.each(inst.sortables, function() {
- if (this.instance.isOver) {
+ draggable.cancelHelperRemoval = false;
- this.instance.isOver = 0;
+ $.each( draggable.sortables, function() {
+ var sortable = this;
- inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
- this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
-
- //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
- if (this.shouldRevert) {
- this.instance.options.revert = this.shouldRevert;
- }
+ if ( sortable.isOver ) {
+ sortable.isOver = 0;
- //Trigger the stop of the sortable
- this.instance._mouseStop(event);
+ // Allow this sortable to handle removing the helper
+ draggable.cancelHelperRemoval = true;
+ sortable.cancelHelperRemoval = false;
- this.instance.options.helper = this.instance.options._helper;
+ // Use _storedCSS To restore properties in the sortable,
+ // as this also handles revert (#9675) since the draggable
+ // may have modified them in unexpected ways (#8809)
+ sortable._storedCSS = {
+ position: sortable.placeholder.css( "position" ),
+ top: sortable.placeholder.css( "top" ),
+ left: sortable.placeholder.css( "left" )
+ };
- //If the helper has been the original item, restore properties in the sortable
- if (inst.options.helper === "original") {
- this.instance.currentItem.css({ top: "auto", left: "auto" });
- }
+ sortable._mouseStop(event);
+ // Once drag has ended, the sortable should return to using
+ // its original helper, not the shared helper from draggable
+ sortable.options.helper = sortable.options._helper;
} else {
- this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
- this.instance._trigger("deactivate", event, uiSortable);
- }
+ // Prevent this Sortable from removing the helper.
+ // However, don't set the draggable to remove the helper
+ // either as another connected Sortable may yet handle the removal.
+ sortable.cancelHelperRemoval = true;
+ sortable._trigger( "deactivate", event, uiSortable );
+ }
});
-
},
- drag: function( event, ui, inst ) {
-
- var that = this;
-
- $.each(inst.sortables, function() {
-
+ drag: function( event, ui, draggable ) {
+ $.each( draggable.sortables, function() {
var innermostIntersecting = false,
- thisSortable = this;
+ sortable = this;
- //Copy over some variables to allow calling the sortable's native _intersectsWith
- this.instance.positionAbs = inst.positionAbs;
- this.instance.helperProportions = inst.helperProportions;
- this.instance.offset.click = inst.offset.click;
+ // Copy over variables that sortable's _intersectsWith uses
+ sortable.positionAbs = draggable.positionAbs;
+ sortable.helperProportions = draggable.helperProportions;
+ sortable.offset.click = draggable.offset.click;
- if (this.instance._intersectsWith(this.instance.containerCache)) {
+ if ( sortable._intersectsWith( sortable.containerCache ) ) {
innermostIntersecting = true;
- $.each(inst.sortables, function() {
- this.instance.positionAbs = inst.positionAbs;
- this.instance.helperProportions = inst.helperProportions;
- this.instance.offset.click = inst.offset.click;
- if (this !== thisSortable &&
- this.instance._intersectsWith(this.instance.containerCache) &&
- $.contains(thisSortable.instance.element[0], this.instance.element[0])
- ) {
+
+ $.each( draggable.sortables, function() {
+ // Copy over variables that sortable's _intersectsWith uses
+ this.positionAbs = draggable.positionAbs;
+ this.helperProportions = draggable.helperProportions;
+ this.offset.click = draggable.offset.click;
+
+ if ( this !== sortable &&
+ this._intersectsWith( this.containerCache ) &&
+ $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
innermostIntersecting = false;
}
+
return innermostIntersecting;
});
}
- if (innermostIntersecting) {
- //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
- if (!this.instance.isOver) {
+ if ( innermostIntersecting ) {
+ // If it intersects, we use a little isOver variable and set it once,
+ // so that the move-in stuff gets fired only once.
+ if ( !sortable.isOver ) {
+ sortable.isOver = 1;
- this.instance.isOver = 1;
- //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 = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-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]; };
+ // Store draggable's parent in case we need to reappend to it later.
+ draggable._parent = ui.helper.parent();
- event.target = this.instance.currentItem[0];
- this.instance._mouseCapture(event, true);
- this.instance._mouseStart(event, true, true);
+ sortable.currentItem = ui.helper
+ .appendTo( sortable.element )
+ .data( "ui-sortable-item", true );
- //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
- this.instance.offset.click.top = inst.offset.click.top;
- this.instance.offset.click.left = inst.offset.click.left;
- this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
- this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
+ // Store helper option to later restore it
+ sortable.options._helper = sortable.options.helper;
- inst._trigger("toSortable", event);
- inst.dropped = this.instance.element; //draggable revert needs that
- //hack so receive/update callbacks work (mostly)
- inst.currentItem = inst.element;
- this.instance.fromOutside = inst;
+ sortable.options.helper = function() {
+ return ui.helper[ 0 ];
+ };
- }
+ // Fire the start events of the sortable with our passed browser event,
+ // and our own helper (so it doesn't create a new one)
+ event.target = sortable.currentItem[ 0 ];
+ sortable._mouseCapture( event, true );
+ sortable._mouseStart( event, true, true );
+
+ // Because the browser event is way off the new appended portlet,
+ // modify necessary variables to reflect the changes
+ sortable.offset.click.top = draggable.offset.click.top;
+ sortable.offset.click.left = draggable.offset.click.left;
+ sortable.offset.parent.left -= draggable.offset.parent.left -
+ sortable.offset.parent.left;
+ sortable.offset.parent.top -= draggable.offset.parent.top -
+ sortable.offset.parent.top;
+
+ draggable._trigger( "toSortable", event );
+
+ // Inform draggable that the helper is in a valid drop zone,
+ // used solely in the revert option to handle "valid/invalid".
+ draggable.dropped = sortable.element;
+
+ // Need to refreshPositions of all sortables in the case that
+ // adding to one sortable changes the location of the other sortables (#9675)
+ $.each( draggable.sortables, function() {
+ this.refreshPositions();
+ });
- //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
- if (this.instance.currentItem) {
- this.instance._mouseDrag(event);
+ // hack so receive/update callbacks work (mostly)
+ draggable.currentItem = draggable.element;
+ sortable.fromOutside = draggable;
}
+ if ( sortable.currentItem ) {
+ sortable._mouseDrag( event );
+ // Copy the sortable's position because the draggable's can potentially reflect
+ // a relative position, while sortable is always absolute, which the dragged
+ // element has now become. (#8809)
+ ui.position = sortable.position;
+ }
} else {
+ // If it doesn't intersect with the sortable, and it intersected before,
+ // we fake the drag stop of the sortable, but make sure it doesn't remove
+ // the helper by using cancelHelperRemoval.
+ if ( sortable.isOver ) {
- //If it doesn't intersect with the sortable, and it intersected before,
- //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
- if (this.instance.isOver) {
-
- this.instance.isOver = 0;
- this.instance.cancelHelperRemoval = true;
+ sortable.isOver = 0;
+ sortable.cancelHelperRemoval = true;
- //Prevent reverting on this forced stop
- this.instance.options.revert = false;
+ // Calling sortable's mouseStop would trigger a revert,
+ // so revert must be temporarily false until after mouseStop is called.
+ sortable.options._revert = sortable.options.revert;
+ sortable.options.revert = false;
- // The out event needs to be triggered independently
- this.instance._trigger("out", event, this.instance._uiHash(this.instance));
+ sortable._trigger( "out", event, sortable._uiHash( sortable ) );
+ sortable._mouseStop( event, true );
- this.instance._mouseStop(event, true);
- this.instance.options.helper = this.instance.options._helper;
+ // restore sortable behaviors that were modfied
+ // when the draggable entered the sortable area (#9481)
+ sortable.options.revert = sortable.options._revert;
+ sortable.options.helper = sortable.options._helper;
- //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
- this.instance.currentItem.remove();
- if (this.instance.placeholder) {
- this.instance.placeholder.remove();
+ if ( sortable.placeholder ) {
+ sortable.placeholder.remove();
}
- inst._trigger("fromSortable", event);
- inst.dropped = false; //draggable revert needs that
- }
+ // Restore and recalculate the draggable's offset considering the sortable
+ // may have modified them in unexpected ways. (#8809, #10669)
+ ui.helper.appendTo( draggable._parent );
+ draggable._refreshOffsets( event );
+ ui.position = draggable._generatePosition( event, true );
- }
+ draggable._trigger( "fromSortable", event );
- });
+ // Inform draggable that the helper is no longer in a valid drop zone
+ draggable.dropped = false;
+ // Need to refreshPositions of all sortables just in case removing
+ // from one sortable changes the location of other sortables (#9675)
+ $.each( draggable.sortables, function() {
+ this.refreshPositions();
+ });
+ }
+ }
+ });
}
});
@@ -6585,30 +6761,35 @@ $.ui.plugin.add("draggable", "opacity", {
$.ui.plugin.add("draggable", "scroll", {
start: function( event, ui, i ) {
- if ( i.scrollParent[ 0 ] !== i.document[ 0 ] && i.scrollParent[ 0 ].tagName !== "HTML" ) {
- i.overflowOffset = i.scrollParent.offset();
+ if ( !i.scrollParentNotHidden ) {
+ i.scrollParentNotHidden = i.helper.scrollParent( false );
+ }
+
+ if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
+ i.overflowOffset = i.scrollParentNotHidden.offset();
}
},
drag: function( event, ui, i ) {
var o = i.options,
scrolled = false,
+ scrollParent = i.scrollParentNotHidden[ 0 ],
document = i.document[ 0 ];
- if ( i.scrollParent[ 0 ] !== document && i.scrollParent[ 0 ].tagName !== "HTML" ) {
- if (!o.axis || o.axis !== "x") {
- if ((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
- i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
- } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
- i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
+ if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
+ if ( !o.axis || o.axis !== "x" ) {
+ if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
+ scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
+ } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
+ scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
}
}
- if (!o.axis || o.axis !== "y") {
- if ((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
- i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
- } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
- i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
+ if ( !o.axis || o.axis !== "y" ) {
+ if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
+ scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
+ } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
+ scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
}
}
@@ -6669,9 +6850,9 @@ $.ui.plugin.add("draggable", "snap", {
for (i = inst.snapElements.length - 1; i >= 0; i--){
- l = inst.snapElements[i].left;
+ l = inst.snapElements[i].left - inst.margins.left;
r = l + inst.snapElements[i].width;
- t = inst.snapElements[i].top;
+ t = inst.snapElements[i].top - inst.margins.top;
b = t + inst.snapElements[i].height;
if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
@@ -6688,16 +6869,16 @@ $.ui.plugin.add("draggable", "snap", {
ls = Math.abs(l - x2) <= d;
rs = Math.abs(r - x1) <= d;
if (ts) {
- ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
}
if (bs) {
- ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
+ ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
}
if (ls) {
- ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
}
if (rs) {
- ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
}
}
@@ -6709,16 +6890,16 @@ $.ui.plugin.add("draggable", "snap", {
ls = Math.abs(l - x1) <= d;
rs = Math.abs(r - x2) <= d;
if (ts) {
- ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
+ ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
}
if (bs) {
- ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
}
if (ls) {
- ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
}
if (rs) {
- ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
+ ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
}
}
@@ -6736,8 +6917,8 @@ $.ui.plugin.add("draggable", "stack", {
start: function( event, ui, instance ) {
var min,
o = instance.options,
- group = $.makeArray($(o.stack)).sort(function(a,b) {
- return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
+ group = $.makeArray($(o.stack)).sort(function(a, b) {
+ return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
});
if (!group.length) { return; }
@@ -6773,10 +6954,10 @@ var draggable = $.ui.draggable;
/*!
- * jQuery UI Resizable 1.11.0
+ * jQuery UI Resizable 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -6785,7 +6966,7 @@ var draggable = $.ui.draggable;
$.widget("ui.resizable", $.ui.mouse, {
- version: "1.11.0",
+ version: "1.11.4",
widgetEventPrefix: "resize",
options: {
alsoResize: false,
@@ -6817,7 +6998,7 @@ $.widget("ui.resizable", $.ui.mouse, {
},
_isNumber: function( value ) {
- return !isNaN( parseInt( value , 10 ) );
+ return !isNaN( parseInt( value, 10 ) );
},
_hasScroll: function( el, a ) {
@@ -6858,7 +7039,7 @@ $.widget("ui.resizable", $.ui.mouse, {
});
// Wrap the element if it cannot hold child nodes
- if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+ if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
this.element.wrap(
$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
@@ -6876,14 +7057,28 @@ $.widget("ui.resizable", $.ui.mouse, {
this.elementIsWrapper = true;
- this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
- this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
+ this.element.css({
+ marginLeft: this.originalElement.css("marginLeft"),
+ marginTop: this.originalElement.css("marginTop"),
+ marginRight: this.originalElement.css("marginRight"),
+ marginBottom: this.originalElement.css("marginBottom")
+ });
+ this.originalElement.css({
+ marginLeft: 0,
+ marginTop: 0,
+ marginRight: 0,
+ marginBottom: 0
+ });
// support: Safari
// Prevent Safari textarea resize
this.originalResizeStyle = this.originalElement.css("resize");
this.originalElement.css("resize", "none");
- this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
+ this._proportionallyResizeElements.push( this.originalElement.css({
+ position: "static",
+ zoom: 1,
+ display: "block"
+ }) );
// support: IE9
// avoid IE jump (hard set the margin)
@@ -6892,8 +7087,21 @@ $.widget("ui.resizable", $.ui.mouse, {
this._proportionallyResize();
}
- this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
- if(this.handles.constructor === String) {
+ this.handles = o.handles ||
+ ( !$(".ui-resizable-handle", this.element).length ?
+ "e,s,se" : {
+ n: ".ui-resizable-n",
+ e: ".ui-resizable-e",
+ s: ".ui-resizable-s",
+ w: ".ui-resizable-w",
+ se: ".ui-resizable-se",
+ sw: ".ui-resizable-sw",
+ ne: ".ui-resizable-ne",
+ nw: ".ui-resizable-nw"
+ } );
+
+ this._handles = $();
+ if ( this.handles.constructor === String ) {
if ( this.handles === "all") {
this.handles = "n,e,s,w,se,sw,ne,nw";
@@ -6902,10 +7110,10 @@ $.widget("ui.resizable", $.ui.mouse, {
n = this.handles.split(",");
this.handles = {};
- for(i = 0; i < n.length; i++) {
+ for (i = 0; i < n.length; i++) {
handle = $.trim(n[i]);
- hname = "ui-resizable-"+handle;
+ hname = "ui-resizable-" + handle;
axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
axis.css({ zIndex: o.zIndex });
@@ -6915,7 +7123,7 @@ $.widget("ui.resizable", $.ui.mouse, {
axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
}
- this.handles[handle] = ".ui-resizable-"+handle;
+ this.handles[handle] = ".ui-resizable-" + handle;
this.element.append(axis);
}
@@ -6927,13 +7135,16 @@ $.widget("ui.resizable", $.ui.mouse, {
target = target || this.element;
- for(i in this.handles) {
+ for (i in this.handles) {
- if(this.handles[i].constructor === String) {
+ if (this.handles[i].constructor === String) {
this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
+ } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
+ this.handles[ i ] = $( this.handles[ i ] );
+ this._on( this.handles[ i ], { "mousedown": that._mouseDown });
}
- if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
axis = $(this.handles[i], this.element);
@@ -6947,21 +7158,17 @@ $.widget("ui.resizable", $.ui.mouse, {
target.css(padPos, padWrapper);
this._proportionallyResize();
-
}
- // TODO: What's that good for? There's not anything to be executed left
- if(!$(this.handles[i]).length) {
- continue;
- }
+ this._handles = this._handles.add( this.handles[ i ] );
}
};
// TODO: make renderAxis a prototype function
this._renderAxis(this.element);
- this._handles = $(".ui-resizable-handle", this.element)
- .disableSelection();
+ this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
+ this._handles.disableSelection();
this._handles.mouseover(function() {
if (!that.resizing) {
@@ -6983,7 +7190,7 @@ $.widget("ui.resizable", $.ui.mouse, {
$(this).removeClass("ui-resizable-autohide");
that._handles.show();
})
- .mouseleave(function(){
+ .mouseleave(function() {
if (o.disabled) {
return;
}
@@ -6995,7 +7202,6 @@ $.widget("ui.resizable", $.ui.mouse, {
}
this._mouseInit();
-
},
_destroy: function() {
@@ -7004,8 +7210,13 @@ $.widget("ui.resizable", $.ui.mouse, {
var wrapper,
_destroy = function(exp) {
- $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
- .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
+ $(exp)
+ .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
+ .removeData("resizable")
+ .removeData("ui-resizable")
+ .unbind(".resizable")
+ .find(".ui-resizable-handle")
+ .remove();
};
// TODO: Unwrap at same DOM position
@@ -7062,13 +7273,34 @@ $.widget("ui.resizable", $.ui.mouse, {
this.offset = this.helper.offset();
this.position = { left: curleft, top: curtop };
- this.size = this._helper ? { width: this.helper.width(), height: this.helper.height() } : { width: el.width(), height: el.height() };
- this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+
+ this.size = this._helper ? {
+ width: this.helper.width(),
+ height: this.helper.height()
+ } : {
+ width: el.width(),
+ height: el.height()
+ };
+
+ this.originalSize = this._helper ? {
+ width: el.outerWidth(),
+ height: el.outerHeight()
+ } : {
+ width: el.width(),
+ height: el.height()
+ };
+
+ this.sizeDiff = {
+ width: el.outerWidth() - el.width(),
+ height: el.outerHeight() - el.height()
+ };
+
this.originalPosition = { left: curleft, top: curtop };
- this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
this.originalMousePosition = { left: event.pageX, top: event.pageY };
- this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
+ this.aspectRatio = (typeof o.aspectRatio === "number") ?
+ o.aspectRatio :
+ ((this.originalSize.width / this.originalSize.height) || 1);
cursor = $(".ui-resizable-" + this.axis).css("cursor");
$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
@@ -7080,28 +7312,20 @@ $.widget("ui.resizable", $.ui.mouse, {
_mouseDrag: function(event) {
- var data,
- el = this.helper, props = {},
+ var data, props,
smp = this.originalMousePosition,
a = this.axis,
- dx = (event.pageX-smp.left)||0,
- dy = (event.pageY-smp.top)||0,
+ dx = (event.pageX - smp.left) || 0,
+ dy = (event.pageY - smp.top) || 0,
trigger = this._change[a];
- this.prevPosition = {
- top: this.position.top,
- left: this.position.left
- };
- this.prevSize = {
- width: this.size.width,
- height: this.size.height
- };
+ this._updatePrevProperties();
if (!trigger) {
return false;
}
- data = trigger.apply(this, [event, dx, dy]);
+ data = trigger.apply(this, [ event, dx, dy ]);
this._updateVirtualBoundaries(event.shiftKey);
if (this._aspectRatio || event.shiftKey) {
@@ -7114,26 +7338,16 @@ $.widget("ui.resizable", $.ui.mouse, {
this._propagate("resize", event);
- if ( this.position.top !== this.prevPosition.top ) {
- props.top = this.position.top + "px";
- }
- if ( this.position.left !== this.prevPosition.left ) {
- props.left = this.position.left + "px";
- }
- if ( this.size.width !== this.prevSize.width ) {
- props.width = this.size.width + "px";
- }
- if ( this.size.height !== this.prevSize.height ) {
- props.height = this.size.height + "px";
- }
- el.css( props );
+ props = this._applyChanges();
if ( !this._helper && this._proportionallyResizeElements.length ) {
this._proportionallyResize();
}
if ( !$.isEmptyObject( props ) ) {
+ this._updatePrevProperties();
this._trigger( "resize", event, this.ui() );
+ this._applyChanges();
}
return false;
@@ -7145,16 +7359,21 @@ $.widget("ui.resizable", $.ui.mouse, {
var pr, ista, soffseth, soffsetw, s, left, top,
o = this.options, that = this;
- if(this._helper) {
+ if (this._helper) {
pr = this._proportionallyResizeElements;
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
- soffseth = ista && this._hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
+ soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
soffsetw = ista ? 0 : that.sizeDiff.width;
- s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
- left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
- top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
+ s = {
+ width: (that.helper.width() - soffsetw),
+ height: (that.helper.height() - soffseth)
+ };
+ left = (parseInt(that.element.css("left"), 10) +
+ (that.position.left - that.originalPosition.left)) || null;
+ top = (parseInt(that.element.css("top"), 10) +
+ (that.position.top - that.originalPosition.top)) || null;
if (!o.animate) {
this.element.css($.extend(s, { top: top, left: left }));
@@ -7182,6 +7401,38 @@ $.widget("ui.resizable", $.ui.mouse, {
},
+ _updatePrevProperties: function() {
+ this.prevPosition = {
+ top: this.position.top,
+ left: this.position.left
+ };
+ this.prevSize = {
+ width: this.size.width,
+ height: this.size.height
+ };
+ },
+
+ _applyChanges: function() {
+ var props = {};
+
+ if ( this.position.top !== this.prevPosition.top ) {
+ props.top = this.position.top + "px";
+ }
+ if ( this.position.left !== this.prevPosition.left ) {
+ props.left = this.position.left + "px";
+ }
+ if ( this.size.width !== this.prevSize.width ) {
+ props.width = this.size.width + "px";
+ }
+ if ( this.size.height !== this.prevSize.height ) {
+ props.height = this.size.height + "px";
+ }
+
+ this.helper.css( props );
+
+ return props;
+ },
+
_updateVirtualBoundaries: function(forceAspectRatio) {
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
o = this.options;
@@ -7193,22 +7444,22 @@ $.widget("ui.resizable", $.ui.mouse, {
maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
};
- if(this._aspectRatio || forceAspectRatio) {
+ if (this._aspectRatio || forceAspectRatio) {
pMinWidth = b.minHeight * this.aspectRatio;
pMinHeight = b.minWidth / this.aspectRatio;
pMaxWidth = b.maxHeight * this.aspectRatio;
pMaxHeight = b.maxWidth / this.aspectRatio;
- if(pMinWidth > b.minWidth) {
+ if (pMinWidth > b.minWidth) {
b.minWidth = pMinWidth;
}
- if(pMinHeight > b.minHeight) {
+ if (pMinHeight > b.minHeight) {
b.minHeight = pMinHeight;
}
- if(pMaxWidth < b.maxWidth) {
+ if (pMaxWidth < b.maxWidth) {
b.maxWidth = pMaxWidth;
}
- if(pMaxHeight < b.maxHeight) {
+ if (pMaxHeight < b.maxHeight) {
b.maxHeight = pMaxHeight;
}
}
@@ -7259,8 +7510,10 @@ $.widget("ui.resizable", $.ui.mouse, {
var o = this._vBoundaries,
a = this.axis,
- ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
- isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
+ ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
+ ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+ isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
+ isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
dw = this.originalPosition.left + this.originalSize.width,
dh = this.position.top + this.size.height,
cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
@@ -7300,32 +7553,56 @@ $.widget("ui.resizable", $.ui.mouse, {
return data;
},
+ _getPaddingPlusBorderDimensions: function( element ) {
+ var i = 0,
+ widths = [],
+ borders = [
+ element.css( "borderTopWidth" ),
+ element.css( "borderRightWidth" ),
+ element.css( "borderBottomWidth" ),
+ element.css( "borderLeftWidth" )
+ ],
+ paddings = [
+ element.css( "paddingTop" ),
+ element.css( "paddingRight" ),
+ element.css( "paddingBottom" ),
+ element.css( "paddingLeft" )
+ ];
+
+ for ( ; i < 4; i++ ) {
+ widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
+ widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
+ }
+
+ return {
+ height: widths[ 0 ] + widths[ 2 ],
+ width: widths[ 1 ] + widths[ 3 ]
+ };
+ },
+
_proportionallyResize: function() {
if (!this._proportionallyResizeElements.length) {
return;
}
- var i, j, borders, paddings, prel,
+ var prel,
+ i = 0,
element = this.helper || this.element;
- for ( i=0; i < this._proportionallyResizeElements.length; i++) {
+ for ( ; i < this._proportionallyResizeElements.length; i++) {
prel = this._proportionallyResizeElements[i];
- if (!this.borderDif) {
- this.borderDif = [];
- borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
- paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
-
- for ( j = 0; j < borders.length; j++ ) {
- this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
- }
+ // TODO: Seems like a bug to cache this.outerDimensions
+ // considering that we are in a loop.
+ if (!this.outerDimensions) {
+ this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
}
prel.css({
- height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
- width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
+ height: (element.height() - this.outerDimensions.height) || 0,
+ width: (element.width() - this.outerDimensions.width) || 0
});
}
@@ -7337,7 +7614,7 @@ $.widget("ui.resizable", $.ui.mouse, {
var el = this.element, o = this.options;
this.elementOffset = el.offset();
- if(this._helper) {
+ if (this._helper) {
this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
@@ -7345,8 +7622,8 @@ $.widget("ui.resizable", $.ui.mouse, {
width: this.element.outerWidth() - 1,
height: this.element.outerHeight() - 1,
position: "absolute",
- left: this.elementOffset.left +"px",
- top: this.elementOffset.top +"px",
+ left: this.elementOffset.left + "px",
+ top: this.elementOffset.top + "px",
zIndex: ++o.zIndex //TODO: Don't modify option
});
@@ -7376,21 +7653,25 @@ $.widget("ui.resizable", $.ui.mouse, {
return { height: this.originalSize.height + dy };
},
se: function(event, dx, dy) {
- return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ return $.extend(this._change.s.apply(this, arguments),
+ this._change.e.apply(this, [ event, dx, dy ]));
},
sw: function(event, dx, dy) {
- return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ return $.extend(this._change.s.apply(this, arguments),
+ this._change.w.apply(this, [ event, dx, dy ]));
},
ne: function(event, dx, dy) {
- return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+ return $.extend(this._change.n.apply(this, arguments),
+ this._change.e.apply(this, [ event, dx, dy ]));
},
nw: function(event, dx, dy) {
- return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+ return $.extend(this._change.n.apply(this, arguments),
+ this._change.w.apply(this, [ event, dx, dy ]));
}
},
_propagate: function(n, event) {
- $.ui.plugin.call(this, n, [event, this.ui()]);
+ $.ui.plugin.call(this, n, [ event, this.ui() ]);
(n !== "resize" && this._trigger(n, event, this.ui()));
},
@@ -7404,9 +7685,7 @@ $.widget("ui.resizable", $.ui.mouse, {
position: this.position,
size: this.size,
originalSize: this.originalSize,
- originalPosition: this.originalPosition,
- prevSize: this.prevSize,
- prevPosition: this.prevPosition
+ originalPosition: this.originalPosition
};
}
@@ -7423,11 +7702,13 @@ $.ui.plugin.add("resizable", "animate", {
o = that.options,
pr = that._proportionallyResizeElements,
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
- soffseth = ista && that._hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
+ soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
soffsetw = ista ? 0 : that.sizeDiff.width,
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
- left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
- top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
+ left = (parseInt(that.element.css("left"), 10) +
+ (that.position.left - that.originalPosition.left)) || null,
+ top = (parseInt(that.element.css("top"), 10) +
+ (that.position.top - that.originalPosition.top)) || null;
that.element.animate(
$.extend(style, top && left ? { top: top, left: left } : {}), {
@@ -7520,7 +7801,7 @@ $.ui.plugin.add( "resizable", "containment", {
}
},
- resize: function( event, ui ) {
+ resize: function( event ) {
var woset, hoset, isParent, isOffsetRelative,
that = $( this ).resizable( "instance" ),
o = that.options,
@@ -7539,7 +7820,11 @@ $.ui.plugin.add( "resizable", "containment", {
}
if ( cp.left < ( that._helper ? co.left : 0 ) ) {
- that.size.width = that.size.width + ( that._helper ? ( that.position.left - co.left ) : ( that.position.left - cop.left ) );
+ that.size.width = that.size.width +
+ ( that._helper ?
+ ( that.position.left - co.left ) :
+ ( that.position.left - cop.left ) );
+
if ( pRatio ) {
that.size.height = that.size.width / that.aspectRatio;
continueResize = false;
@@ -7548,7 +7833,11 @@ $.ui.plugin.add( "resizable", "containment", {
}
if ( cp.top < ( that._helper ? co.top : 0 ) ) {
- that.size.height = that.size.height + ( that._helper ? ( that.position.top - co.top ) : that.position.top );
+ that.size.height = that.size.height +
+ ( that._helper ?
+ ( that.position.top - co.top ) :
+ that.position.top );
+
if ( pRatio ) {
that.size.width = that.size.height * that.aspectRatio;
continueResize = false;
@@ -7556,19 +7845,27 @@ $.ui.plugin.add( "resizable", "containment", {
that.position.top = that._helper ? co.top : 0;
}
- that.offset.left = that.parentData.left + that.position.left;
- that.offset.top = that.parentData.top + that.position.top;
-
- woset = Math.abs( ( that._helper ? that.offset.left - cop.left : ( that.offset.left - co.left ) ) + that.sizeDiff.width );
- hoset = Math.abs( ( that._helper ? that.offset.top - cop.top : ( that.offset.top - co.top ) ) + that.sizeDiff.height );
-
isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
if ( isParent && isOffsetRelative ) {
- woset -= Math.abs( that.parentData.left );
+ that.offset.left = that.parentData.left + that.position.left;
+ that.offset.top = that.parentData.top + that.position.top;
+ } else {
+ that.offset.left = that.element.offset().left;
+ that.offset.top = that.element.offset().top;
}
+ woset = Math.abs( that.sizeDiff.width +
+ (that._helper ?
+ that.offset.left - cop.left :
+ (that.offset.left - co.left)) );
+
+ hoset = Math.abs( that.sizeDiff.height +
+ (that._helper ?
+ that.offset.top - cop.top :
+ (that.offset.top - co.top)) );
+
if ( woset + that.size.width >= that.parentData.width ) {
that.size.width = that.parentData.width - woset;
if ( pRatio ) {
@@ -7585,15 +7882,15 @@ $.ui.plugin.add( "resizable", "containment", {
}
}
- if ( !continueResize ){
- that.position.left = ui.prevPosition.left;
- that.position.top = ui.prevPosition.top;
- that.size.width = ui.prevSize.width;
- that.size.height = ui.prevSize.height;
+ if ( !continueResize ) {
+ that.position.left = that.prevPosition.left;
+ that.position.top = that.prevPosition.top;
+ that.size.width = that.prevSize.width;
+ that.size.height = that.prevSize.height;
}
},
- stop: function(){
+ stop: function() {
var that = $( this ).resizable( "instance" ),
o = that.options,
co = that.containerOffset,
@@ -7624,61 +7921,49 @@ $.ui.plugin.add( "resizable", "containment", {
$.ui.plugin.add("resizable", "alsoResize", {
- start: function () {
+ start: function() {
var that = $(this).resizable( "instance" ),
- o = that.options,
- _store = function (exp) {
- $(exp).each(function() {
- var el = $(this);
- el.data("ui-resizable-alsoresize", {
- width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
- left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
- });
- });
- };
+ o = that.options;
- if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
- if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
- else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
- }else{
- _store(o.alsoResize);
- }
+ $(o.alsoResize).each(function() {
+ var el = $(this);
+ el.data("ui-resizable-alsoresize", {
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+ left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
+ });
+ });
},
- resize: function (event, ui) {
+ resize: function(event, ui) {
var that = $(this).resizable( "instance" ),
o = that.options,
os = that.originalSize,
op = that.originalPosition,
delta = {
- height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
- top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
- },
-
- _alsoResize = function (exp, c) {
- $(exp).each(function() {
- var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
- css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
+ height: (that.size.height - os.height) || 0,
+ width: (that.size.width - os.width) || 0,
+ top: (that.position.top - op.top) || 0,
+ left: (that.position.left - op.left) || 0
+ };
- $.each(css, function (i, prop) {
- var sum = (start[prop]||0) + (delta[prop]||0);
- if (sum && sum >= 0) {
- style[prop] = sum || null;
- }
- });
+ $(o.alsoResize).each(function() {
+ var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
+ css = el.parents(ui.originalElement[0]).length ?
+ [ "width", "height" ] :
+ [ "width", "height", "top", "left" ];
- el.css(style);
+ $.each(css, function(i, prop) {
+ var sum = (start[prop] || 0) + (delta[prop] || 0);
+ if (sum && sum >= 0) {
+ style[prop] = sum || null;
+ }
});
- };
- if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
- $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
- }else{
- _alsoResize(o.alsoResize);
- }
+ el.css(style);
+ });
},
- stop: function () {
+ stop: function() {
$(this).removeData("resizable-alsoresize");
}
});
@@ -7691,7 +7976,16 @@ $.ui.plugin.add("resizable", "ghost", {
that.ghost = that.originalElement.clone();
that.ghost
- .css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
+ .css({
+ opacity: 0.25,
+ display: "block",
+ position: "relative",
+ height: cs.height,
+ width: cs.width,
+ margin: 0,
+ left: 0,
+ top: 0
+ })
.addClass("ui-resizable-ghost")
.addClass(typeof o.ghost === "string" ? o.ghost : "");
@@ -7699,10 +7993,14 @@ $.ui.plugin.add("resizable", "ghost", {
},
- resize: function(){
+ resize: function() {
var that = $(this).resizable( "instance" );
if (that.ghost) {
- that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
+ that.ghost.css({
+ position: "relative",
+ height: that.size.height,
+ width: that.size.width
+ });
}
},
@@ -7718,15 +8016,16 @@ $.ui.plugin.add("resizable", "ghost", {
$.ui.plugin.add("resizable", "grid", {
resize: function() {
- var that = $(this).resizable( "instance" ),
+ var outerDimensions,
+ that = $(this).resizable( "instance" ),
o = that.options,
cs = that.size,
os = that.originalSize,
op = that.originalPosition,
a = that.axis,
- grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
- gridX = (grid[0]||1),
- gridY = (grid[1]||1),
+ grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
+ gridX = (grid[0] || 1),
+ gridY = (grid[1] || 1),
ox = Math.round((cs.width - os.width) / gridX) * gridX,
oy = Math.round((cs.height - os.height) / gridY) * gridY,
newWidth = os.width + ox,
@@ -7739,16 +8038,16 @@ $.ui.plugin.add("resizable", "grid", {
o.grid = grid;
if (isMinWidth) {
- newWidth = newWidth + gridX;
+ newWidth += gridX;
}
if (isMinHeight) {
- newHeight = newHeight + gridY;
+ newHeight += gridY;
}
if (isMaxWidth) {
- newWidth = newWidth - gridX;
+ newWidth -= gridX;
}
if (isMaxHeight) {
- newHeight = newHeight - gridY;
+ newHeight -= gridY;
}
if (/^(se|s|e)$/.test(a)) {
@@ -7763,19 +8062,25 @@ $.ui.plugin.add("resizable", "grid", {
that.size.height = newHeight;
that.position.left = op.left - ox;
} else {
+ if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
+ outerDimensions = that._getPaddingPlusBorderDimensions( this );
+ }
+
if ( newHeight - gridY > 0 ) {
that.size.height = newHeight;
that.position.top = op.top - oy;
} else {
- that.size.height = gridY;
- that.position.top = op.top + os.height - gridY;
+ newHeight = gridY - outerDimensions.height;
+ that.size.height = newHeight;
+ that.position.top = op.top + os.height - newHeight;
}
if ( newWidth - gridX > 0 ) {
that.size.width = newWidth;
that.position.left = op.left - ox;
} else {
- that.size.width = gridX;
- that.position.left = op.left + os.width - gridX;
+ newWidth = gridX - outerDimensions.width;
+ that.size.width = newWidth;
+ that.position.left = op.left + os.width - newWidth;
}
}
}
@@ -7786,10 +8091,10 @@ var resizable = $.ui.resizable;
/*!
- * jQuery UI Dialog 1.11.0
+ * jQuery UI Dialog 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -7798,7 +8103,7 @@ var resizable = $.ui.resizable;
var dialog = $.widget( "ui.dialog", {
- version: "1.11.0",
+ version: "1.11.4",
options: {
appendTo: "body",
autoOpen: true,
@@ -7918,6 +8223,7 @@ var dialog = $.widget( "ui.dialog", {
var next,
originalPosition = this.originalPosition;
+ this._untrackInstance();
this._destroyOverlay();
this.element
@@ -7996,10 +8302,10 @@ var dialog = $.widget( "ui.dialog", {
_moveToTop: function( event, silent ) {
var moved = false,
- zIndicies = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
+ zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
return +$( this ).css( "z-index" );
}).get(),
- zIndexMax = Math.max.apply( null, zIndicies );
+ zIndexMax = Math.max.apply( null, zIndices );
if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
this.uiDialog.css( "z-index", zIndexMax + 1 );
@@ -8028,11 +8334,24 @@ var dialog = $.widget( "ui.dialog", {
this._position();
this._createOverlay();
this._moveToTop( null, true );
+
+ // Ensure the overlay is moved to the top with the dialog, but only when
+ // opening. The overlay shouldn't move after the dialog is open so that
+ // modeless dialogs opened after the modal dialog stack properly.
+ if ( this.overlay ) {
+ this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
+ }
+
this._show( this.uiDialog, this.options.show, function() {
that._focusTabbable();
that._trigger( "focus" );
});
+ // Track the dialog immediately upon openening in case a focus event
+ // somehow occurs outside of the dialog before an element inside the
+ // dialog is focused (#10152)
+ this._makeFocusTarget();
+
this._trigger( "open" );
},
@@ -8344,14 +8663,18 @@ var dialog = $.widget( "ui.dialog", {
_trackFocus: function() {
this._on( this.widget(), {
- "focusin": function( event ) {
- this._untrackInstance();
- this._trackingInstances().unshift( this );
+ focusin: function( event ) {
+ this._makeFocusTarget();
this._focusedElement = $( event.target );
}
});
},
+ _makeFocusTarget: function() {
+ this._untrackInstance();
+ this._trackingInstances().unshift( this );
+ },
+
_untrackInstance: function() {
var instances = this._trackingInstances(),
exists = $.inArray( this, instances );
@@ -8625,10 +8948,10 @@ var dialog = $.widget( "ui.dialog", {
/*!
- * jQuery UI Droppable 1.11.0
+ * jQuery UI Droppable 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -8637,7 +8960,7 @@ var dialog = $.widget( "ui.dialog", {
$.widget( "ui.droppable", {
- version: "1.11.0",
+ version: "1.11.4",
widgetEventPrefix: "drop",
options: {
accept: "*",
@@ -8801,7 +9124,7 @@ $.widget( "ui.droppable", {
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
- $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance )
+ $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
) { childrenIntersection = true; return false; }
});
if ( childrenIntersection ) {
@@ -8839,15 +9162,14 @@ $.ui.intersect = (function() {
return ( x >= reference ) && ( x < ( reference + size ) );
}
- return function( draggable, droppable, toleranceMode ) {
+ return function( draggable, droppable, toleranceMode, event ) {
if ( !droppable.offset ) {
return false;
}
- var draggableLeft, draggableTop,
- x1 = ( draggable.positionAbs || draggable.position.absolute ).left,
- y1 = ( draggable.positionAbs || draggable.position.absolute ).top,
+ var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
+ y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
x2 = x1 + draggable.helperProportions.width,
y2 = y1 + draggable.helperProportions.height,
l = droppable.offset.left,
@@ -8864,9 +9186,7 @@ $.ui.intersect = (function() {
t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
case "pointer":
- draggableLeft = ( ( draggable.positionAbs || draggable.position.absolute ).left + ( draggable.clickOffset || draggable.offset.click ).left );
- draggableTop = ( ( draggable.positionAbs || draggable.position.absolute ).top + ( draggable.clickOffset || draggable.offset.click ).top );
- return isOverAxis( draggableTop, t, droppable.proportions().height ) && isOverAxis( draggableLeft, l, droppable.proportions().width );
+ return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
case "touch":
return (
( y1 >= t && y1 <= b ) || // Top edge touching
@@ -8936,7 +9256,7 @@ $.ui.ddmanager = {
if ( !this.options ) {
return;
}
- if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance ) ) {
+ if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
dropped = this._drop.call( this, event ) || dropped;
}
@@ -8973,7 +9293,7 @@ $.ui.ddmanager = {
}
var parentInstance, scope, parent,
- intersects = $.ui.intersect( draggable, this, this.options.tolerance ),
+ intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
if ( !c ) {
return;
@@ -9025,10 +9345,10 @@ var droppable = $.ui.droppable;
/*!
- * jQuery UI Effects 1.11.0
+ * jQuery UI Effects 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -9036,7 +9356,11 @@ var droppable = $.ui.droppable;
*/
-var dataSpace = "ui-effects-";
+var dataSpace = "ui-effects-",
+
+ // Create a local jQuery because jQuery Color relies on it and the
+ // global may not exist with AMD and a custom build (#10199)
+ jQuery = $;
$.effects = {
effect: {}
@@ -9645,7 +9969,7 @@ color.hook = function( hook ) {
}
try {
elem.style[ hook ] = value;
- } catch( e ) {
+ } catch ( e ) {
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
}
}
@@ -9916,7 +10240,7 @@ $.fn.extend({
(function() {
$.extend( $.effects, {
- version: "1.11.0",
+ version: "1.11.4",
// Saves a set of properties in a data storage
save: function( element, set ) {
@@ -10010,7 +10334,7 @@ $.extend( $.effects, {
// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
try {
active.id;
- } catch( e ) {
+ } catch ( e ) {
active = document.body;
}
@@ -10312,10 +10636,10 @@ var effect = $.effects;
/*!
- * jQuery UI Effects Blind 1.11.0
+ * jQuery UI Effects Blind 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10389,10 +10713,10 @@ var effectBlind = $.effects.effect.blind = function( o, done ) {
/*!
- * jQuery UI Effects Bounce 1.11.0
+ * jQuery UI Effects Bounce 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10499,10 +10823,10 @@ var effectBounce = $.effects.effect.bounce = function( o, done ) {
/*!
- * jQuery UI Effects Clip 1.11.0
+ * jQuery UI Effects Clip 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10563,10 +10887,10 @@ var effectClip = $.effects.effect.clip = function( o, done ) {
/*!
- * jQuery UI Effects Drop 1.11.0
+ * jQuery UI Effects Drop 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10593,7 +10917,7 @@ var effectDrop = $.effects.effect.drop = function( o, done ) {
el.show();
$.effects.createWrapper( el );
- distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
+ distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
if ( show ) {
el
@@ -10625,10 +10949,10 @@ var effectDrop = $.effects.effect.drop = function( o, done ) {
/*!
- * jQuery UI Effects Explode 1.11.0
+ * jQuery UI Effects Explode 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10719,10 +11043,10 @@ var effectExplode = $.effects.effect.explode = function( o, done ) {
/*!
- * jQuery UI Effects Fade 1.11.0
+ * jQuery UI Effects Fade 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10746,10 +11070,10 @@ var effectFade = $.effects.effect.fade = function( o, done ) {
/*!
- * jQuery UI Effects Fold 1.11.0
+ * jQuery UI Effects Fold 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10819,10 +11143,10 @@ var effectFold = $.effects.effect.fold = function( o, done ) {
/*!
- * jQuery UI Effects Highlight 1.11.0
+ * jQuery UI Effects Highlight 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -10866,10 +11190,10 @@ var effectHighlight = $.effects.effect.highlight = function( o, done ) {
/*!
- * jQuery UI Effects Size 1.11.0
+ * jQuery UI Effects Size 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11086,10 +11410,10 @@ var effectSize = $.effects.effect.size = function( o, done ) {
/*!
- * jQuery UI Effects Scale 1.11.0
+ * jQuery UI Effects Scale 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11161,10 +11485,10 @@ var effectScale = $.effects.effect.scale = function( o, done ) {
/*!
- * jQuery UI Effects Puff 1.11.0
+ * jQuery UI Effects Puff 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11207,10 +11531,10 @@ var effectPuff = $.effects.effect.puff = function( o, done ) {
/*!
- * jQuery UI Effects Pulsate 1.11.0
+ * jQuery UI Effects Pulsate 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11267,10 +11591,10 @@ var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
/*!
- * jQuery UI Effects Shake 1.11.0
+ * jQuery UI Effects Shake 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11338,10 +11662,10 @@ var effectShake = $.effects.effect.shake = function( o, done ) {
/*!
- * jQuery UI Effects Slide 1.11.0
+ * jQuery UI Effects Slide 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11399,10 +11723,10 @@ var effectSlide = $.effects.effect.slide = function( o, done ) {
/*!
- * jQuery UI Effects Transfer 1.11.0
+ * jQuery UI Effects Transfer 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11443,10 +11767,10 @@ var effectTransfer = $.effects.effect.transfer = function( o, done ) {
/*!
- * jQuery UI Progressbar 1.11.0
+ * jQuery UI Progressbar 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11455,7 +11779,7 @@ var effectTransfer = $.effects.effect.transfer = function( o, done ) {
var progressbar = $.widget( "ui.progressbar", {
- version: "1.11.0",
+ version: "1.11.4",
options: {
max: 100,
value: 0,
@@ -11588,10 +11912,10 @@ var progressbar = $.widget( "ui.progressbar", {
/*!
- * jQuery UI Selectable 1.11.0
+ * jQuery UI Selectable 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11600,7 +11924,7 @@ var progressbar = $.widget( "ui.progressbar", {
var selectable = $.widget("ui.selectable", $.ui.mouse, {
- version: "1.11.0",
+ version: "1.11.4",
options: {
appendTo: "body",
autoRefresh: true,
@@ -11860,10 +12184,10 @@ var selectable = $.widget("ui.selectable", $.ui.mouse, {
/*!
- * jQuery UI Selectmenu 1.11.0
+ * jQuery UI Selectmenu 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -11872,7 +12196,7 @@ var selectable = $.widget("ui.selectable", $.ui.mouse, {
var selectmenu = $.widget( "ui.selectmenu", {
- version: "1.11.0",
+ version: "1.11.4",
defaultElement: "<select>",
options: {
appendTo: null,
@@ -11912,8 +12236,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
},
_drawButton: function() {
- var that = this,
- tabindex = this.element.attr( "tabindex" );
+ var that = this;
// Associate existing label with the new button
this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
@@ -11930,7 +12253,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
// Create button
this.button = $( "<span>", {
"class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
- tabindex: tabindex || this.options.disabled ? -1 : 0,
+ tabindex: this.options.disabled ? -1 : 0,
id: this.ids.button,
role: "combobox",
"aria-expanded": "false",
@@ -11951,7 +12274,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
.appendTo( this.button );
this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
- this._setOption( "width", this.options.width );
+ this._resizeButton();
this._on( this.button, this._buttonEvents );
this.button.one( "focusin", function() {
@@ -11989,6 +12312,12 @@ var selectmenu = $.widget( "ui.selectmenu", {
role: "listbox",
select: function( event, ui ) {
event.preventDefault();
+
+ // support: IE8
+ // If the item was selected via a click, the text selection
+ // will be destroyed in IE
+ that._setSelection();
+
that._select( ui.item.data( "ui-selectmenu-item" ), event );
},
focus: function( event, ui ) {
@@ -12031,7 +12360,9 @@ var selectmenu = $.widget( "ui.selectmenu", {
refresh: function() {
this._refreshMenu();
this._setText( this.buttonText, this._getSelectedItem().text() );
- this._setOption( "width", this.options.width );
+ if ( !this.options.width ) {
+ this._resizeButton();
+ }
},
_refreshMenu: function() {
@@ -12097,6 +12428,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
this.isOpen = false;
this._toggleAttr();
+ this.range = null;
this._off( this.document );
this._trigger( "close", event );
@@ -12185,6 +12517,29 @@ var selectmenu = $.widget( "ui.selectmenu", {
this[ this.isOpen ? "close" : "open" ]( event );
},
+ _setSelection: function() {
+ var selection;
+
+ if ( !this.range ) {
+ return;
+ }
+
+ if ( window.getSelection ) {
+ selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange( this.range );
+
+ // support: IE8
+ } else {
+ this.range.select();
+ }
+
+ // support: IE
+ // Setting the text selection kills the button focus in IE, but
+ // restoring the focus doesn't kill the selection.
+ this.button.focus();
+ },
+
_documentClick: {
mousedown: function( event ) {
if ( !this.isOpen ) {
@@ -12198,7 +12553,28 @@ var selectmenu = $.widget( "ui.selectmenu", {
},
_buttonEvents: {
- click: "_toggle",
+
+ // Prevent text selection from being reset when interacting with the selectmenu (#10144)
+ mousedown: function() {
+ var selection;
+
+ if ( window.getSelection ) {
+ selection = window.getSelection();
+ if ( selection.rangeCount ) {
+ this.range = selection.getRangeAt( 0 );
+ }
+
+ // support: IE8
+ } else {
+ this.range = document.selection.createRange();
+ }
+ },
+
+ click: function( event ) {
+ this._setSelection();
+ this._toggle( event );
+ },
+
keydown: function( event ) {
var preventDefault = true;
switch ( event.keyCode ) {
@@ -12320,10 +12696,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
}
if ( key === "width" ) {
- if ( !value ) {
- value = this.element.outerWidth();
- }
- this.button.outerWidth( value );
+ this._resizeButton();
}
},
@@ -12356,6 +12729,17 @@ var selectmenu = $.widget( "ui.selectmenu", {
this.menu.attr( "aria-hidden", !this.isOpen );
},
+ _resizeButton: function() {
+ var width = this.options.width;
+
+ if ( !width ) {
+ width = this.element.show().outerWidth();
+ this.element.hide();
+ }
+
+ this.button.outerWidth( width );
+ },
+
_resizeMenu: function() {
this.menu.outerWidth( Math.max(
this.button.outerWidth(),
@@ -12379,7 +12763,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
data.push({
element: option,
index: index,
- value: option.attr( "value" ),
+ value: option.val(),
label: option.text(),
optgroup: optgroup.attr( "label" ) || "",
disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
@@ -12399,10 +12783,10 @@ var selectmenu = $.widget( "ui.selectmenu", {
/*!
- * jQuery UI Slider 1.11.0
+ * jQuery UI Slider 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -12411,7 +12795,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
var slider = $.widget( "ui.slider", $.ui.mouse, {
- version: "1.11.0",
+ version: "1.11.4",
widgetEventPrefix: "slide",
options: {
@@ -12443,6 +12827,7 @@ var slider = $.widget( "ui.slider", $.ui.mouse, {
this._handleIndex = null;
this._detectOrientation();
this._mouseInit();
+ this._calculateNewMax();
this.element
.addClass( "ui-slider" +
@@ -12839,6 +13224,9 @@ var slider = $.widget( "ui.slider", $.ui.mouse, {
.removeClass( "ui-slider-horizontal ui-slider-vertical" )
.addClass( "ui-slider-" + this.orientation );
this._refreshValue();
+
+ // Reset positioning from previous orientation
+ this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
break;
case "value":
this._animateOff = true;
@@ -12854,9 +13242,11 @@ var slider = $.widget( "ui.slider", $.ui.mouse, {
}
this._animateOff = false;
break;
+ case "step":
case "min":
case "max":
this._animateOff = true;
+ this._calculateNewMax();
this._refreshValue();
this._animateOff = false;
break;
@@ -12894,7 +13284,7 @@ var slider = $.widget( "ui.slider", $.ui.mouse, {
// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals = this.options.values.slice();
- for ( i = 0; i < vals.length; i+= 1) {
+ for ( i = 0; i < vals.length; i += 1) {
vals[ i ] = this._trimAlignValue( vals[ i ] );
}
@@ -12925,12 +13315,35 @@ var slider = $.widget( "ui.slider", $.ui.mouse, {
return parseFloat( alignValue.toFixed(5) );
},
+ _calculateNewMax: function() {
+ var max = this.options.max,
+ min = this._valueMin(),
+ step = this.options.step,
+ aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
+ max = aboveMin + min;
+ this.max = parseFloat( max.toFixed( this._precision() ) );
+ },
+
+ _precision: function() {
+ var precision = this._precisionOf( this.options.step );
+ if ( this.options.min !== null ) {
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
+ }
+ return precision;
+ },
+
+ _precisionOf: function( num ) {
+ var str = num.toString(),
+ decimal = str.indexOf( "." );
+ return decimal === -1 ? 0 : str.length - decimal - 1;
+ },
+
_valueMin: function() {
return this.options.min;
},
_valueMax: function() {
- return this.options.max;
+ return this.max;
},
_refreshValue: function() {
@@ -13072,10 +13485,10 @@ var slider = $.widget( "ui.slider", $.ui.mouse, {
/*!
- * jQuery UI Sortable 1.11.0
+ * jQuery UI Sortable 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -13084,7 +13497,7 @@ var slider = $.widget( "ui.slider", $.ui.mouse, {
var sortable = $.widget("ui.sortable", $.ui.mouse, {
- version: "1.11.0",
+ version: "1.11.4",
widgetEventPrefix: "sort",
ready: false,
options: {
@@ -13135,17 +13548,12 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
},
_create: function() {
-
- var o = this.options;
this.containerCache = {};
this.element.addClass("ui-sortable");
//Get the items
this.refresh();
- //Let's determine if the items are being displayed horizontally
- this.floating = this.items.length ? o.axis === "x" || this._isFloating(this.items[0].item) : false;
-
//Let's determine the parent's offset
this.offset = this.element.offset();
@@ -13334,7 +13742,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
}
//Prepare scrolling
- if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
+ if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
this.overflowOffset = this.scrollParent.offset();
}
@@ -13386,7 +13794,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
//Do scrolling
if(this.options.scroll) {
- if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
+ if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
@@ -13402,16 +13810,16 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
} else {
- if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
- scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
- } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
- scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+ if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
+ scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
+ } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
+ scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
}
- if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
- scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
- } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
- scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+ if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
+ scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
+ } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
+ scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
}
}
@@ -13510,10 +13918,10 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
animation = {};
if ( !axis || axis === "x" ) {
- animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft);
+ animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
}
if ( !axis || axis === "y" ) {
- animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop);
+ animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
}
this.reverting = true;
$(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
@@ -13706,7 +14114,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
if(connectWith && connected) {
for (i = connectWith.length - 1; i >= 0; i--){
- cur = $(connectWith[i]);
+ cur = $(connectWith[i], this.document[0]);
for ( j = cur.length - 1; j >= 0; j--){
inst = $.data(cur[j], this.widgetFullName);
if(inst && inst !== this && !inst.options.disabled) {
@@ -13756,7 +14164,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
for (i = connectWith.length - 1; i >= 0; i--){
- cur = $(connectWith[i]);
+ cur = $(connectWith[i], this.document[0]);
for (j = cur.length - 1; j >= 0; j--){
inst = $.data(cur[j], this.widgetFullName);
if(inst && inst !== this && !inst.options.disabled) {
@@ -13789,6 +14197,11 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
refreshPositions: function(fast) {
+ // Determine whether items are being displayed horizontally
+ this.floating = this.items.length ?
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
+ false;
+
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
if(this.offsetParent && this.helper) {
this.offset.parent = this._getParentOffset();
@@ -13846,12 +14259,13 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
.removeClass("ui-sortable-helper");
- if ( nodeName === "tr" ) {
- that.currentItem.children().each(function() {
- $( "<td>&#160;</td>", that.document[0] )
- .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
- .appendTo( element );
- });
+ if ( nodeName === "tbody" ) {
+ that._createTrPlaceholder(
+ that.currentItem.find( "tr" ).eq( 0 ),
+ $( "<tr>", that.document[ 0 ] ).appendTo( element )
+ );
+ } else if ( nodeName === "tr" ) {
+ that._createTrPlaceholder( that.currentItem, element );
} else if ( nodeName === "img" ) {
element.attr( "src", that.currentItem.attr( "src" ) );
}
@@ -13888,6 +14302,16 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
},
+ _createTrPlaceholder: function( sourceTr, targetTr ) {
+ var that = this;
+
+ sourceTr.children().each(function() {
+ $( "<td>&#160;</td>", that.document[ 0 ] )
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
+ .appendTo( targetTr );
+ });
+ },
+
_contactContainers: function(event) {
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
innermostContainer = null,
@@ -13969,6 +14393,10 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
}
if(this.currentContainer === this.containers[innermostIndex]) {
+ if ( !this.currentContainer.containerCache.over ) {
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
+ this.currentContainer.containerCache.over = 1;
+ }
return;
}
@@ -14044,14 +14472,14 @@ var sortable = $.widget("ui.sortable", $.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 && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+ if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
po.left += this.scrollParent.scrollLeft();
po.top += this.scrollParent.scrollTop();
}
// This needs to be actually done for all browsers, since pageX/pageY includes this information
// with an ugly IE fix
- if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
+ if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
po = { top: 0, left: 0 };
}
@@ -14101,8 +14529,8 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
this.containment = [
0 - this.offset.relative.left - this.offset.parent.left,
0 - this.offset.relative.top - this.offset.parent.top,
- $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left,
- ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+ o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
+ (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
}
@@ -14127,7 +14555,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
pos = this.position;
}
var mod = d === "absolute" ? 1 : -1,
- scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
+ scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
return {
@@ -14153,13 +14581,13 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
o = this.options,
pageX = event.pageX,
pageY = event.pageY,
- 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);
+ scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
// This is another very weird special case that only happens for relative elements:
// 1. If the css position is relative
// 2. and the scroll parent is the document or similar to the offset parent
// we have to refresh the relative offset during the scroll so there are no jumps
- if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) {
+ if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
this.offset.relative = this._getRelativeOffset();
}
@@ -14307,18 +14735,6 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
}
this.dragging = false;
- if(this.cancelHelperRemoval) {
- if(!noPropagation) {
- this._trigger("beforeStop", event, this._uiHash());
- for (i=0; i < delayedTriggers.length; i++) {
- delayedTriggers[i].call(this, event);
- } //Trigger all delayed events
- this._trigger("stop", event, this._uiHash());
- }
-
- this.fromOutside = false;
- return false;
- }
if(!noPropagation) {
this._trigger("beforeStop", event, this._uiHash());
@@ -14327,10 +14743,12 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
- if(this.helper[0] !== this.currentItem[0]) {
- this.helper.remove();
+ if ( !this.cancelHelperRemoval ) {
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
+ this.helper.remove();
+ }
+ this.helper = null;
}
- this.helper = null;
if(!noPropagation) {
for (i=0; i < delayedTriggers.length; i++) {
@@ -14340,7 +14758,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
}
this.fromOutside = false;
- return true;
+ return !this.cancelHelperRemoval;
},
@@ -14367,10 +14785,10 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
/*!
- * jQuery UI Spinner 1.11.0
+ * jQuery UI Spinner 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -14390,7 +14808,7 @@ function spinner_modifier( fn ) {
}
var spinner = $.widget( "ui.spinner", {
- version: "1.11.0",
+ version: "1.11.4",
defaultElement: "<input>",
widgetEventPrefix: "spin",
options: {
@@ -14866,10 +15284,10 @@ var spinner = $.widget( "ui.spinner", {
/*!
- * jQuery UI Tabs 1.11.0
+ * jQuery UI Tabs 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -14878,7 +15296,7 @@ var spinner = $.widget( "ui.spinner", {
var tabs = $.widget( "ui.tabs", {
- version: "1.11.0",
+ version: "1.11.4",
delay: 300,
options: {
active: null,
@@ -14928,24 +15346,7 @@ var tabs = $.widget( "ui.tabs", {
this.element
.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
- .toggleClass( "ui-tabs-collapsible", options.collapsible )
- // Prevent users from focusing disabled tabs via click
- .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) {
- if ( $( this ).is( ".ui-state-disabled" ) ) {
- event.preventDefault();
- }
- })
- // support: IE <9
- // Preventing the default action in mousedown doesn't prevent IE
- // from focusing the element, so if the anchor gets focused, blur.
- // We don't have to worry about focusing the previously focused
- // element since clicking on a non-focusable element should focus
- // the body anyway.
- .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
- if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
- this.blur();
- }
- });
+ .toggleClass( "ui-tabs-collapsible", options.collapsible );
this._processTabs();
options.active = this._initialActive();
@@ -15071,8 +15472,9 @@ var tabs = $.widget( "ui.tabs", {
clearTimeout( this.activating );
selectedIndex = this._focusNextTab( selectedIndex, goingForward );
- // Navigating with control key will prevent automatic activation
- if ( !event.ctrlKey ) {
+ // Navigating with control/command key will prevent automatic activation
+ if ( !event.ctrlKey && !event.metaKey ) {
+
// Update aria-selected immediately so that AT think the tab is already selected.
// Otherwise AT may confuse the user by stating that they need to activate the tab,
// but the tab will already be activated by the time the announcement finishes.
@@ -15242,11 +15644,33 @@ var tabs = $.widget( "ui.tabs", {
},
_processTabs: function() {
- var that = this;
+ var that = this,
+ prevTabs = this.tabs,
+ prevAnchors = this.anchors,
+ prevPanels = this.panels;
this.tablist = this._getList()
.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
- .attr( "role", "tablist" );
+ .attr( "role", "tablist" )
+
+ // Prevent users from focusing disabled tabs via click
+ .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
+ if ( $( this ).is( ".ui-state-disabled" ) ) {
+ event.preventDefault();
+ }
+ })
+
+ // support: IE <9
+ // Preventing the default action in mousedown doesn't prevent IE
+ // from focusing the element, so if the anchor gets focused, blur.
+ // We don't have to worry about focusing the previously focused
+ // element since clicking on a non-focusable element should focus
+ // the body anyway.
+ .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
+ if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
+ this.blur();
+ }
+ });
this.tabs = this.tablist.find( "> li:has(a[href])" )
.addClass( "ui-state-default ui-corner-top" )
@@ -15307,6 +15731,13 @@ var tabs = $.widget( "ui.tabs", {
this.panels
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.attr( "role", "tabpanel" );
+
+ // Avoid memory leaks (#10056)
+ if ( prevTabs ) {
+ this._off( prevTabs.not( this.tabs ) );
+ this._off( prevAnchors.not( this.anchors ) );
+ this._off( prevPanels.not( this.panels ) );
+ }
},
// allow overriding how to find the list for rare usage scenarios (#7715)
@@ -15564,6 +15995,8 @@ var tabs = $.widget( "ui.tabs", {
.removeAttr( "tabIndex" )
.removeUniqueId();
+ this.tablist.unbind( this.eventNamespace );
+
this.tabs.add( this.panels ).each(function() {
if ( $.data( this, "ui-tabs-destroy" ) ) {
$( this ).remove();
@@ -15655,6 +16088,18 @@ var tabs = $.widget( "ui.tabs", {
eventData = {
tab: tab,
panel: panel
+ },
+ complete = function( jqXHR, status ) {
+ if ( status === "abort" ) {
+ that.panels.stop( false, true );
+ }
+
+ tab.removeClass( "ui-tabs-loading" );
+ panel.removeAttr( "aria-busy" );
+
+ if ( jqXHR === that.xhr ) {
+ delete that.xhr;
+ }
};
// not remote
@@ -15672,28 +16117,21 @@ var tabs = $.widget( "ui.tabs", {
panel.attr( "aria-busy", "true" );
this.xhr
- .success(function( response ) {
+ .done(function( response, status, jqXHR ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
panel.html( response );
that._trigger( "load", event, eventData );
+
+ complete( jqXHR, status );
}, 1 );
})
- .complete(function( jqXHR, status ) {
+ .fail(function( jqXHR, status ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
- if ( status === "abort" ) {
- that.panels.stop( false, true );
- }
-
- tab.removeClass( "ui-tabs-loading" );
- panel.removeAttr( "aria-busy" );
-
- if ( jqXHR === that.xhr ) {
- delete that.xhr;
- }
+ complete( jqXHR, status );
}, 1 );
});
}
@@ -15718,10 +16156,10 @@ var tabs = $.widget( "ui.tabs", {
/*!
- * jQuery UI Tooltip 1.11.0
+ * jQuery UI Tooltip 1.11.4
* http://jqueryui.com
*
- * Copyright 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -15730,7 +16168,7 @@ var tabs = $.widget( "ui.tabs", {
var tooltip = $.widget( "ui.tooltip", {
- version: "1.11.0",
+ version: "1.11.4",
options: {
content: function() {
// support: IE<9, Opera in jQuery <1.7
@@ -15790,6 +16228,7 @@ var tooltip = $.widget( "ui.tooltip", {
// IDs of generated tooltips, needed for destroy
this.tooltips = {};
+
// IDs of parent tooltips where we removed the title attribute
this.parents = {};
@@ -15821,8 +16260,8 @@ var tooltip = $.widget( "ui.tooltip", {
this._super( key, value );
if ( key === "content" ) {
- $.each( this.tooltips, function( id, element ) {
- that._updateContent( element );
+ $.each( this.tooltips, function( id, tooltipData ) {
+ that._updateContent( tooltipData.element );
});
}
},
@@ -15831,9 +16270,9 @@ var tooltip = $.widget( "ui.tooltip", {
var that = this;
// close open tooltips
- $.each( this.tooltips, function( id, element ) {
+ $.each( this.tooltips, function( id, tooltipData ) {
var event = $.Event( "blur" );
- event.target = event.currentTarget = element[0];
+ event.target = event.currentTarget = tooltipData.element[ 0 ];
that.close( event, true );
});
@@ -15897,6 +16336,7 @@ var tooltip = $.widget( "ui.tooltip", {
});
}
+ this._registerCloseHandlers( event, target );
this._updateContent( target, event );
},
@@ -15911,13 +16351,16 @@ var tooltip = $.widget( "ui.tooltip", {
}
content = contentOption.call( target[0], function( response ) {
- // ignore async response if tooltip was closed already
- if ( !target.data( "ui-tooltip-open" ) ) {
- return;
- }
+
// IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
that._delay(function() {
+
+ // Ignore async response if tooltip was closed already
+ if ( !target.data( "ui-tooltip-open" ) ) {
+ return;
+ }
+
// jQuery creates a special event for focusin when it doesn't
// exist natively. To improve performance, the native event
// object is reused and the type is changed. Therefore, we can't
@@ -15935,7 +16378,7 @@ var tooltip = $.widget( "ui.tooltip", {
},
_open: function( event, target, content ) {
- var tooltip, events, delayedShow, a11yContent,
+ var tooltipData, tooltip, delayedShow, a11yContent,
positionOption = $.extend( {}, this.options.position );
if ( !content ) {
@@ -15944,9 +16387,9 @@ var tooltip = $.widget( "ui.tooltip", {
// Content can be updated multiple times. If the tooltip already
// exists, then just update the content and bail.
- tooltip = this._find( target );
- if ( tooltip.length ) {
- tooltip.find( ".ui-tooltip-content" ).html( content );
+ tooltipData = this._find( target );
+ if ( tooltipData ) {
+ tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
return;
}
@@ -15965,7 +16408,8 @@ var tooltip = $.widget( "ui.tooltip", {
}
}
- tooltip = this._tooltip( target );
+ tooltipData = this._tooltip( target );
+ tooltip = tooltipData.tooltip;
this._addDescribedBy( target, tooltip.attr( "id" ) );
tooltip.find( ".ui-tooltip-content" ).html( content );
@@ -16016,8 +16460,10 @@ var tooltip = $.widget( "ui.tooltip", {
}
this._trigger( "open", event, { tooltip: tooltip } );
+ },
- events = {
+ _registerCloseHandlers: function( event, target ) {
+ var events = {
keyup: function( event ) {
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
var fakeEvent = $.Event(event);
@@ -16031,7 +16477,7 @@ var tooltip = $.widget( "ui.tooltip", {
// tooltips will handle this in destroy.
if ( target[ 0 ] !== this.element[ 0 ] ) {
events.remove = function() {
- this._removeTooltip( tooltip );
+ this._removeTooltip( this._find( target ).tooltip );
};
}
@@ -16045,13 +16491,27 @@ var tooltip = $.widget( "ui.tooltip", {
},
close: function( event ) {
- var that = this,
+ var tooltip,
+ that = this,
target = $( event ? event.currentTarget : this.element ),
- tooltip = this._find( target );
+ tooltipData = this._find( target );
+
+ // The tooltip may already be closed
+ if ( !tooltipData ) {
+
+ // We set ui-tooltip-open immediately upon open (in open()), but only set the
+ // additional data once there's actually content to show (in _open()). So even if the
+ // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
+ // the period between open() and _open().
+ target.removeData( "ui-tooltip-open" );
+ return;
+ }
+
+ tooltip = tooltipData.tooltip;
// disabling closes the tooltip, so we need to track when we're closing
// to avoid an infinite loop in case the tooltip becomes disabled on close
- if ( this.closing ) {
+ if ( tooltipData.closing ) {
return;
}
@@ -16066,6 +16526,7 @@ var tooltip = $.widget( "ui.tooltip", {
this._removeDescribedBy( target );
+ tooltipData.hiding = true;
tooltip.stop( true );
this._hide( tooltip, this.options.hide, function() {
that._removeTooltip( $( this ) );
@@ -16087,9 +16548,11 @@ var tooltip = $.widget( "ui.tooltip", {
});
}
- this.closing = true;
+ tooltipData.closing = true;
this._trigger( "close", event, { tooltip: tooltip } );
- this.closing = false;
+ if ( !tooltipData.hiding ) {
+ tooltipData.closing = false;
+ }
},
_tooltip: function( element ) {
@@ -16104,13 +16567,16 @@ var tooltip = $.widget( "ui.tooltip", {
.appendTo( tooltip );
tooltip.appendTo( this.document[0].body );
- this.tooltips[ id ] = element;
- return tooltip;
+
+ return this.tooltips[ id ] = {
+ element: element,
+ tooltip: tooltip
+ };
},
_find: function( target ) {
var id = target.data( "ui-tooltip-id" );
- return id ? $( "#" + id ) : $();
+ return id ? this.tooltips[ id ] : null;
},
_removeTooltip: function( tooltip ) {
@@ -16122,10 +16588,11 @@ var tooltip = $.widget( "ui.tooltip", {
var that = this;
// close open tooltips
- $.each( this.tooltips, function( id, element ) {
+ $.each( this.tooltips, function( id, tooltipData ) {
// Delegate to close method to handle common cleanup
- var event = $.Event( "blur" );
- event.target = event.currentTarget = element[0];
+ var event = $.Event( "blur" ),
+ element = tooltipData.element;
+ event.target = event.currentTarget = element[ 0 ];
that.close( event, true );
// Remove immediately; destroying an open tooltip doesn't use the