aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2012-10-12 22:56:45 +0200
committerFelix Nagel <info@felixnagel.com>2012-10-12 22:56:45 +0200
commitc59fbbaad74f7bee73b57985570f689c9a5d9383 (patch)
tree89209c996ac48c84a0ce20e77061eaef04f87d6c /ui
parentfc729a8c8ebfbe9c05f8b1ebbd6629898f3fc6c0 (diff)
parent94221c4e5b11496ef927889e1541d84b5746fb31 (diff)
downloadjquery-ui-c59fbbaad74f7bee73b57985570f689c9a5d9383.tar.gz
jquery-ui-c59fbbaad74f7bee73b57985570f689c9a5d9383.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.core.js8
-rw-r--r--ui/jquery.ui.datepicker.js2
-rw-r--r--ui/jquery.ui.dialog.js6
-rw-r--r--ui/jquery.ui.draggable.js18
-rw-r--r--ui/jquery.ui.mouse.js2
-rw-r--r--ui/jquery.ui.resizable.js4
-rw-r--r--ui/jquery.ui.sortable.js31
-rw-r--r--ui/jquery.ui.tabs.js11
-rw-r--r--ui/jquery.ui.tooltip.js22
9 files changed, 77 insertions, 27 deletions
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js
index bb9411dc9..e569eea42 100644
--- a/ui/jquery.ui.core.js
+++ b/ui/jquery.ui.core.js
@@ -69,7 +69,7 @@ $.fn.extend({
scrollParent: function() {
var scrollParent;
- if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+ if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
scrollParent = this.parents().filter(function() {
return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
}).eq(0);
@@ -258,6 +258,12 @@ $(function() {
// deprecated
+(function() {
+ var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
+ $.ui.ie = uaMatch.length ? true : false;
+ $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6;
+})();
+
$.fn.extend({
disableSelection: function() {
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 9ea36924b..4643af2eb 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -1605,7 +1605,7 @@ $.extend(Datepicker.prototype, {
}
html += group;
}
- html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
+ html += buttonPanel + ($.ui.ie6 && !inst.inline ?
'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
inst._keyEvent = false;
return html;
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 77424047c..8593fff85 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -364,7 +364,7 @@ $.widget("ui.dialog", {
props = $.isFunction( props ) ?
{ click: props, text: name } :
props;
- var button = $( "<button type='button'>" )
+ var button = $( "<button type='button'></button>" )
.attr( props, true )
.unbind( "click" )
.click(function() {
@@ -768,7 +768,7 @@ $.extend( $.ui.dialog.overlay, {
var scrollHeight,
offsetHeight;
// handle IE
- if ( $.browser.msie ) {
+ if ( $.ui.ie ) {
scrollHeight = Math.max(
document.documentElement.scrollHeight,
document.body.scrollHeight
@@ -793,7 +793,7 @@ $.extend( $.ui.dialog.overlay, {
var scrollWidth,
offsetWidth;
// handle IE
- if ( $.browser.msie ) {
+ if ( $.ui.ie ) {
scrollWidth = Math.max(
document.documentElement.scrollWidth,
document.body.scrollWidth
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 2e33e3311..5d91a3d94 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -318,7 +318,7 @@ $.widget("ui.draggable", $.ui.mouse, {
}
if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
- || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
po = { top: 0, left: 0 };
return {
@@ -571,13 +571,29 @@ $.ui.plugin.add("draggable", "connectToSortable", {
$.each(inst.sortables, function(i) {
+ var innermostIntersecting = false;
+ var thisSortable = 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;
if(this.instance._intersectsWith(this.instance.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)
+ && $.ui.contains(thisSortable.instance.element[0], this.instance.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) {
diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js
index 30546ffc4..f5069d00c 100644
--- a/ui/jquery.ui.mouse.js
+++ b/ui/jquery.ui.mouse.js
@@ -111,7 +111,7 @@ $.widget("ui.mouse", {
_mouseMove: function(event) {
// IE mouseup check - mouseup happened when mouse was out of window
- if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
+ if ($.ui.ie && !(document.documentMode >= 9) && !event.button) {
return this._mouseUp(event);
}
diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js
index 724ae9ddf..cc82b8b92 100644
--- a/ui/jquery.ui.resizable.js
+++ b/ui/jquery.ui.resizable.js
@@ -466,8 +466,8 @@ $.widget("ui.resizable", $.ui.mouse, {
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
// fix ie6 offset TODO: This seems broken
- var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
- pxyoffset = ( ie6 ? 2 : -1 );
+ var ie6offset = ($.ui.ie6 ? 1 : 0),
+ pxyoffset = ( $.ui.ie6 ? 2 : -1 );
this.helper.addClass(this._helper).css({
width: this.element.outerWidth() + pxyoffset,
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index 070dff6cd..a2132a9bd 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -562,14 +562,13 @@ $.widget("ui.sortable", $.ui.mouse, {
var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
- for (var i=0; i < this.items.length; i++) {
-
+ this.items = $.grep(this.items, function (item) {
for (var j=0; j < list.length; j++) {
- if(list[j] == this.items[i].item[0])
- this.items.splice(i,1);
+ if(list[j] == item.item[0])
+ return false;
};
-
- };
+ return true;
+ });
},
@@ -735,16 +734,26 @@ $.widget("ui.sortable", $.ui.mouse, {
if(this.containers.length === 1) {
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
this.containers[innermostIndex].containerCache.over = 1;
- } else if(this.currentContainer != this.containers[innermostIndex]) {
+ } else {
//When entering a new container, we will find the item with the least distance and append our item near it
- var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
+ var dist = 10000; var itemWithLeastDistance = null;
+ var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top';
+ var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height';
+ var base = this.positionAbs[posProperty] + this.offset.click[posProperty];
for (var j = this.items.length - 1; j >= 0; j--) {
if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
- var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
+ if(this.items[j].item[0] == this.currentItem[0]) continue;
+ var cur = this.items[j].item.offset()[posProperty];
+ var nearBottom = false;
+ if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
+ nearBottom = true;
+ cur += this.items[j][sizeProperty];
+ }
+
if(Math.abs(cur - base) < dist) {
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
- this.direction = (cur - base > 0) ? 'down' : 'up';
+ this.direction = nearBottom ? "up": "down";
}
}
@@ -822,7 +831,7 @@ $.widget("ui.sortable", $.ui.mouse, {
}
if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
- || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
po = { top: 0, left: 0 };
return {
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 506ee27d7..7d38fb46e 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -51,7 +51,8 @@ $.widget( "ui.tabs", {
var panel,
that = this,
options = this.options,
- active = options.active;
+ active = options.active,
+ locationHash = location.hash.substring( 1 );
this.running = false;
@@ -80,9 +81,9 @@ $.widget( "ui.tabs", {
if ( active === null ) {
// check the fragment identifier in the URL
- if ( location.hash ) {
- this.anchors.each(function( i, anchor ) {
- if ( anchor.hash === location.hash ) {
+ if ( locationHash ) {
+ this.tabs.each(function( i, tab ) {
+ if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
active = i;
return false;
}
@@ -91,7 +92,7 @@ $.widget( "ui.tabs", {
// check for a tab marked active via a class
if ( active === null ) {
- active = this.tabs.filter( ".ui-tabs-active" ).index();
+ active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
}
// no active tab, set to false
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index f38379f21..980b43868 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -140,6 +140,8 @@ $.widget( "ui.tooltip", {
this._find( target ).position( $.extend({
of: target
}, this.options.position ) );
+ // Stop tracking (#8622)
+ this._off( this.document, "mousemove" );
return;
}
@@ -214,7 +216,7 @@ $.widget( "ui.tooltip", {
positionOption.of = event;
tooltip.position( positionOption );
}
- if ( this.options.track && /^mouse/.test( event.originalEvent.type ) ) {
+ if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
positionOption = $.extend( {}, this.options.position );
this._on( this.document, {
mousemove: position
@@ -315,8 +317,24 @@ $.widget( "ui.tooltip", {
},
_destroy: function() {
- $.each( this.tooltips, function( id ) {
+ var that = this;
+
+ // close open tooltips
+ $.each( this.tooltips, function( id, element ) {
+ // Delegate to close method to handle common cleanup
+ var event = $.Event( "blur" );
+ event.target = event.currentTarget = element[0];
+ that.close( event, true );
+
+ // Remove immediately; destroying an open tooltip doesn't use the
+ // hide animation
$( "#" + id ).remove();
+
+ // Restore the title
+ if ( element.data( "ui-tooltip-title" ) ) {
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
+ element.removeData( "ui-tooltip-title" );
+ }
});
}
});