aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2012-05-31 18:43:42 +0200
committerFelix Nagel <info@felixnagel.com>2012-05-31 18:43:42 +0200
commit749c8fbb6673a15c6477b43d6a6a4f7101f85a5b (patch)
treee10cd0ba0124f646d568e1dea5aa177d14f949cc /ui
parent8abe1d015f5b8d1aa68ccc9dd1ad4744b0216938 (diff)
parente0fe788ee0c0c0d8d23f9d90b9acff713ba1302f (diff)
downloadjquery-ui-749c8fbb6673a15c6477b43d6a6a4f7101f85a5b.tar.gz
jquery-ui-749c8fbb6673a15c6477b43d6a6a4f7101f85a5b.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui')
-rw-r--r--ui/i18n/jquery.ui.datepicker-ka.js (renamed from ui/i18n/jquery.ui.datepicker-ge.js)4
-rw-r--r--ui/jquery.ui.accordion.js49
-rw-r--r--ui/jquery.ui.autocomplete.js1
-rw-r--r--ui/jquery.ui.core.js19
-rw-r--r--ui/jquery.ui.dialog.js12
-rw-r--r--ui/jquery.ui.draggable.js16
-rw-r--r--ui/jquery.ui.droppable.js9
-rw-r--r--ui/jquery.ui.menu.js115
-rw-r--r--ui/jquery.ui.resizable.js4
-rw-r--r--ui/jquery.ui.selectable.js8
-rw-r--r--ui/jquery.ui.spinner.js3
-rw-r--r--ui/jquery.ui.tabs.js78
12 files changed, 205 insertions, 113 deletions
diff --git a/ui/i18n/jquery.ui.datepicker-ge.js b/ui/i18n/jquery.ui.datepicker-ka.js
index 10d4e5851..c10658d79 100644
--- a/ui/i18n/jquery.ui.datepicker-ge.js
+++ b/ui/i18n/jquery.ui.datepicker-ka.js
@@ -1,7 +1,7 @@
/* Georgian (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Lado Lomidze (lado.lomidze@gmail.com). */
jQuery(function($){
- $.datepicker.regional['ge'] = {
+ $.datepicker.regional['ka'] = {
closeText: 'დახურვა',
prevText: '&#x3c; წინა',
nextText: 'შემდეგი &#x3e;',
@@ -17,5 +17,5 @@ jQuery(function($){
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
- $.datepicker.setDefaults($.datepicker.regional['ge']);
+ $.datepicker.setDefaults($.datepicker.regional['ka']);
});
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index f713d25b8..856b3ba4b 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -389,9 +389,9 @@ $.widget( "ui.accordion", {
toHide = active.next(),
eventData = {
oldHeader: active,
- oldContent: toHide,
+ oldPanel: toHide,
newHeader: collapsing ? $() : clicked,
- newContent: toShow
+ newPanel: toShow
};
event.preventDefault();
@@ -437,8 +437,8 @@ $.widget( "ui.accordion", {
},
_toggle: function( data ) {
- var toShow = data.newContent,
- toHide = this.prevShow.length ? this.prevShow : data.oldContent;
+ var toShow = data.newPanel,
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
// handle activating a panel during the animation for another activation
this.prevShow.add( this.prevHide ).stop( true, true );
@@ -453,16 +453,23 @@ $.widget( "ui.accordion", {
this._toggleComplete( data );
}
- toHide
- .attr({
- "aria-expanded": "false",
- "aria-hidden": "true"
+ toHide.attr({
+ "aria-expanded": "false",
+ "aria-hidden": "true"
+ });
+ toHide.prev().attr( "aria-selected", "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
+ if ( toShow.length && toHide.length ) {
+ toHide.prev().attr( "tabIndex", -1 );
+ } else if ( toShow.length ) {
+ this.headers.filter(function() {
+ return $( this ).attr( "tabIndex" ) === 0;
})
- .prev()
- .attr({
- "aria-selected": "false",
- tabIndex: -1
- });
+ .attr( "tabIndex", -1 );
+ }
+
toShow
.attr({
"aria-expanded": "true",
@@ -517,7 +524,7 @@ $.widget( "ui.accordion", {
},
_toggleComplete: function( data ) {
- var toHide = data.oldContent;
+ var toHide = data.oldPanel;
toHide
.removeClass( "ui-accordion-content-active" )
@@ -669,9 +676,19 @@ if ( $.uiBackCompat !== false ) {
}
if ( type === "beforeActivate" ) {
- ret = _trigger.call( this, "changestart", event, data );
+ ret = _trigger.call( this, "changestart", event, {
+ oldHeader: data.oldHeader,
+ oldContent: data.oldPanel,
+ newHeader: data.newHeader,
+ newContent: data.newPanel
+ });
} else if ( type === "activate" ) {
- ret = _trigger.call( this, "change", event, data );
+ ret = _trigger.call( this, "change", event, {
+ oldHeader: data.oldHeader,
+ oldContent: data.oldPanel,
+ newHeader: data.newHeader,
+ newContent: data.newPanel
+ });
}
return ret;
};
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index e5cc9e693..2fb7e395c 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -429,7 +429,6 @@ $.widget( "ui.autocomplete", {
},
_close: function( event ) {
- clearTimeout( this.closing );
if ( this.menu.element.is( ":visible" ) ) {
this.menu.element.hide();
this.menu.blur();
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js
index d8fff91e1..a511de24b 100644
--- a/ui/jquery.ui.core.js
+++ b/ui/jquery.ui.core.js
@@ -9,6 +9,9 @@
*/
(function( $, undefined ) {
+var uuid = 0,
+ runiqueId = /^ui-id-\d+$/;
+
// prevent duplicate loading
// this is only a problem because we proxy existing functions
// and we don't want to double proxy them
@@ -107,6 +110,22 @@ $.fn.extend({
return 0;
},
+ uniqueId: function() {
+ return this.each(function() {
+ if ( !this.id ) {
+ this.id = "ui-id-" + (++uuid);
+ }
+ });
+ },
+
+ removeUniqueId: function() {
+ return this.each(function() {
+ if ( runiqueId.test( this.id ) ) {
+ $( this ).removeAttr( "id" );
+ }
+ });
+ },
+
disableSelection: function() {
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
".ui-disableSelection", function( event ) {
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index e48c26400..4ef8a20cb 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -87,7 +87,6 @@ $.widget("ui.dialog", {
options = this.options,
title = options.title || "&#160;",
- titleId = $.ui.dialog.getTitleId( this.element ),
uiDialog = ( this.uiDialog = $( "<div>" ) )
.addClass( uiDialogClasses + options.dialogClass )
@@ -105,10 +104,6 @@ $.widget("ui.dialog", {
event.preventDefault();
}
})
- .attr({
- role: "dialog",
- "aria-labelledby": titleId
- })
.mousedown(function( event ) {
that.moveToTop( false, event );
})
@@ -140,8 +135,8 @@ $.widget("ui.dialog", {
.appendTo( uiDialogTitlebarClose ),
uiDialogTitle = $( "<span>" )
+ .uniqueId()
.addClass( "ui-dialog-title" )
- .attr( "id", titleId )
.html( title )
.prependTo( uiDialogTitlebar ),
@@ -152,6 +147,11 @@ $.widget("ui.dialog", {
.addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane );
+ uiDialog.attr({
+ role: "dialog",
+ "aria-labelledby": uiDialogTitle.attr( "id" )
+ });
+
uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection();
this._hoverable( uiDialogTitlebarClose );
this._focusable( uiDialogTitlebarClose );
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 84077ed29..1845f0891 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -55,17 +55,9 @@ $.widget("ui.draggable", $.ui.mouse, {
},
- destroy: function() {
- if(!this.element.data('draggable')) return;
- this.element
- .removeData("draggable")
- .unbind(".draggable")
- .removeClass("ui-draggable"
- + " ui-draggable-dragging"
- + " ui-draggable-disabled");
+ _destroy: function() {
+ this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
this._mouseDestroy();
-
- return this;
},
_mouseCapture: function(event) {
@@ -102,6 +94,8 @@ $.widget("ui.draggable", $.ui.mouse, {
//Create and append the visible helper
this.helper = this._createHelper(event);
+ this.helper.addClass("ui-draggable-dragging");
+
//Cache the helper size
this._cacheHelperProportions();
@@ -162,7 +156,7 @@ $.widget("ui.draggable", $.ui.mouse, {
if ($.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, event);
- this.helper.addClass("ui-draggable-dragging");
+
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js
index 47d3e38e9..e2ad221e1 100644
--- a/ui/jquery.ui.droppable.js
+++ b/ui/jquery.ui.droppable.js
@@ -47,18 +47,13 @@ $.widget("ui.droppable", {
},
- destroy: function() {
+ _destroy: function() {
var drop = $.ui.ddmanager.droppables[this.options.scope];
for ( var i = 0; i < drop.length; i++ )
if ( drop[i] == this )
drop.splice(i, 1);
- this.element
- .removeClass("ui-droppable ui-droppable-disabled")
- .removeData("droppable")
- .unbind(".droppable");
-
- return this;
+ this.element.removeClass("ui-droppable ui-droppable-disabled");
},
_setOption: function(key, value) {
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 1bfd76716..54a85abf5 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -13,8 +13,7 @@
*/
(function($) {
-var idIncrement = 0,
- currentEventTarget = null;
+var currentEventTarget = null;
$.widget( "ui.menu", {
version: "@VERSION",
@@ -35,14 +34,11 @@ $.widget( "ui.menu", {
},
_create: function() {
this.activeMenu = this.element;
- this.menuId = this.element.attr( "id" ) || "ui-menu-" + idIncrement++;
- if ( this.element.find( ".ui-icon" ).length ) {
- this.element.addClass( "ui-menu-icons" );
- }
this.element
+ .uniqueId()
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
.attr({
- id: this.menuId,
role: this.options.role,
tabIndex: 0
})
@@ -95,9 +91,9 @@ $.widget( "ui.menu", {
target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
this.focus( event, target );
},
- "mouseleave": "collapseAll",
+ mouseleave: "collapseAll",
"mouseleave .ui-menu": "collapseAll",
- "focus": function( event ) {
+ focus: function( event ) {
var menu = this.element,
firstItem = menu.children( ".ui-menu-item" ).eq( 0 );
if ( this._hasScroll() && !this.active ) {
@@ -120,11 +116,13 @@ $.widget( "ui.menu", {
}
});
},
- "keydown": "_keydown"
+ keydown: "_keydown"
});
this.refresh();
+ // TODO: We probably shouldn't bind to document for each menu.
+ // TODO: This isn't being cleaned up on destroy.
this._bind( this.document, {
click: function( event ) {
if ( !$( event.target ).closest( ".ui-menu" ).length ) {
@@ -145,19 +143,22 @@ $.widget( "ui.menu", {
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-hidden" )
+ .removeAttr( "aria-disabled" )
+ .removeUniqueId()
.show();
// destroy menu items
this.element.find( ".ui-menu-item" )
- .unbind( ".menu" )
.removeClass( "ui-menu-item" )
.removeAttr( "role" )
+ .removeAttr( "aria-disabled" )
.children( "a" )
+ .removeUniqueId()
.removeClass( "ui-corner-all ui-state-hover" )
.removeAttr( "tabIndex" )
.removeAttr( "role" )
.removeAttr( "aria-haspopup" )
- .removeAttr( "id" )
+ // TODO: is this correct? Don't these exist in the original markup?
.children( ".ui-icon" )
.remove();
@@ -166,82 +167,80 @@ $.widget( "ui.menu", {
},
_keydown: function( event ) {
+ 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 );
- event.preventDefault();
break;
case $.ui.keyCode.PAGE_DOWN:
this.nextPage( event );
- event.preventDefault();
break;
case $.ui.keyCode.HOME:
this._move( "first", "first", event );
- event.preventDefault();
break;
case $.ui.keyCode.END:
this._move( "last", "last", event );
- event.preventDefault();
break;
case $.ui.keyCode.UP:
this.previous( event );
- event.preventDefault();
break;
case $.ui.keyCode.DOWN:
this.next( event );
- event.preventDefault();
break;
case $.ui.keyCode.LEFT:
this.collapse( event );
- event.preventDefault();
break;
case $.ui.keyCode.RIGHT:
if ( !this.active.is( ".ui-state-disabled" ) ) {
this.expand( event );
}
- event.preventDefault();
break;
case $.ui.keyCode.ENTER:
this._activate( event );
- event.preventDefault();
break;
case $.ui.keyCode.SPACE:
this._activate( event );
- event.preventDefault();
break;
case $.ui.keyCode.ESCAPE:
this.collapse( event );
- event.preventDefault();
break;
default:
+ preventDefault = false;
+ prev = this.previousFilter || "";
+ character = String.fromCharCode( event.keyCode );
+ skip = false;
+
clearTimeout( this.filterTimer );
- var match,
- prev = this.previousFilter || "",
- character = String.fromCharCode( event.keyCode ),
- skip = false;
if ( character === prev ) {
skip = true;
} else {
character = prev + character;
}
- function escape( value ) {
- return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
- }
+
match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
return new RegExp( "^" + escape( character ), "i" )
.test( $( this ).children( "a" ).text() );
});
- match = skip && match.index(this.active.next()) !== -1 ?
- this.active.nextAll(".ui-menu-item") :
+ match = skip && match.index( this.active.next() ) !== -1 ?
+ this.active.nextAll( ".ui-menu-item" ) :
match;
+
+ // TODO: document what's going on here, character is reset to the original value
if ( !match.length ) {
- character = String.fromCharCode(event.keyCode);
- match = this.activeMenu.children(".ui-menu-item").filter(function() {
+ character = String.fromCharCode( event.keyCode );
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
return new RegExp( "^" + escape(character), "i" )
.test( $( this ).children( "a" ).text() );
});
}
+
if ( match.length ) {
this.focus( event, match );
if ( match.length > 1 ) {
@@ -256,6 +255,10 @@ $.widget( "ui.menu", {
delete this.previousFilter;
}
}
+
+ if ( preventDefault ) {
+ event.preventDefault();
+ }
},
_activate: function( event ) {
@@ -271,7 +274,6 @@ $.widget( "ui.menu", {
refresh: function() {
// initialize nested menus
var menus,
- menuId = this.menuId,
submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
.hide()
@@ -288,15 +290,21 @@ $.widget( "ui.menu", {
.addClass( "ui-menu-item" )
.attr( "role", "presentation" )
.children( "a" )
+ .uniqueId()
.addClass( "ui-corner-all" )
- .attr( "tabIndex", -1 )
- .attr( "role", this._itemRole() )
- .attr( "id", function( i ) {
- return menuId + "-" + i;
+ .attr({
+ tabIndex: -1,
+ role: this._itemRole()
});
- // initialize unlinked menu-items as dividers
- menus.children( ":not(.ui-menu-item)" ).addClass( "ui-widget-content ui-menu-divider" );
+ // initialize unlinked menu-items containing spaces and/or dashes only as dividers
+ menus.children( ":not(.ui-menu-item)" ).each( function() {
+ var item = $( this );
+ // hypen, em dash, en dash
+ if ( !/[^\-—–\s]/.test( item.text() ) ) {
+ item.addClass( "ui-widget-content ui-menu-divider" );
+ }
+ });
// add aria-disabled attribute to any disabled menu item
menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
@@ -305,7 +313,8 @@ $.widget( "ui.menu", {
var menu = $( this ),
item = menu.prev( "a" );
- item.attr( "aria-haspopup", "true" )
+ item
+ .attr( "aria-haspopup", "true" )
.prepend( '<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>' );
menu.attr( "aria-labelledby", item.attr( "id" ) );
});
@@ -333,7 +342,11 @@ $.widget( "ui.menu", {
}
// highlight active parent menu item, if any
- this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" );
+ this.active
+ .parent()
+ .closest( ".ui-menu-item" )
+ .children( "a:first" )
+ .addClass( "ui-state-active" );
if ( event && event.type === "keydown" ) {
this._close();
@@ -401,18 +414,18 @@ $.widget( "ui.menu", {
},
_open: function( submenu ) {
+ var position = $.extend({
+ of: this.active
+ }, $.type( this.options.position ) === "function" ?
+ this.options.position( this.active ) :
+ this.options.position
+ );
+
clearTimeout( this.timer );
this.element.find( ".ui-menu" ).not( submenu.parents() )
.hide()
.attr( "aria-hidden", "true" );
- var position = $.extend( {}, {
- of: this.active
- }, $.type( this.options.position ) === "function" ?
- this.options.position( this.active ) :
- this.options.position
- );
-
submenu
.show()
.removeAttr( "aria-hidden" )
@@ -476,7 +489,7 @@ $.widget( "ui.menu", {
if ( newItem && newItem.length ) {
this._open( newItem.parent() );
- //timeout so Firefox will not hide activedescendant change in expanding submenu from AT
+ // timeout so Firefox will not hide activedescendant change in expanding submenu from AT
this._delay(function() {
this.focus( event, newItem );
}, 20 );
diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js
index 6039cf648..f9330e843 100644
--- a/ui/jquery.ui.resizable.js
+++ b/ui/jquery.ui.resizable.js
@@ -190,13 +190,13 @@ $.widget("ui.resizable", $.ui.mouse, {
},
- destroy: function() {
+ _destroy: function() {
this._mouseDestroy();
var _destroy = function(exp) {
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
- .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
+ .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
};
//TODO: Unwrap at same DOM position
diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js
index f8a0134f8..2db9a8886 100644
--- a/ui/jquery.ui.selectable.js
+++ b/ui/jquery.ui.selectable.js
@@ -61,17 +61,13 @@ $.widget("ui.selectable", $.ui.mouse, {
this.helper = $("<div class='ui-selectable-helper'></div>");
},
- destroy: function() {
+ _destroy: function() {
this.selectees
.removeClass("ui-selectee")
.removeData("selectable-item");
this.element
- .removeClass("ui-selectable ui-selectable-disabled")
- .removeData("selectable")
- .unbind(".selectable");
+ .removeClass("ui-selectable ui-selectable-disabled");
this._mouseDestroy();
-
- return this;
},
_mouseStart: function(event) {
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js
index 1e4204a0c..b01feec9a 100644
--- a/ui/jquery.ui.spinner.js
+++ b/ui/jquery.ui.spinner.js
@@ -427,7 +427,7 @@ $.widget( "ui.spinner", {
this._refresh();
},
- destroy: function() {
+ _destroy: function() {
this.element
.removeClass( "ui-spinner-input" )
.prop( "disabled", false )
@@ -436,7 +436,6 @@ $.widget( "ui.spinner", {
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
- this._super();
this.uiSpinner.replaceWith( this.element );
},
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index a693899da..a64dca6e4 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -34,6 +34,7 @@ $.widget( "ui.tabs", {
active: null,
collapsible: false,
event: "click",
+ heightStyle: "content",
hide: null,
show: null,
@@ -150,6 +151,10 @@ $.widget( "ui.tabs", {
if ( key === "event" ) {
this._setupEvents( value );
}
+
+ if ( key === "heightStyle" ) {
+ this._setupHeightStyle( value );
+ }
},
_tabId: function( tab ) {
@@ -202,6 +207,7 @@ $.widget( "ui.tabs", {
this._setupDisabled( options.disabled );
this._setupEvents( options.event );
+ this._setupHeightStyle( options.heightStyle );
// remove all handlers, may run on existing tabs
this.lis.unbind( ".tabs" );
@@ -241,7 +247,9 @@ $.widget( "ui.tabs", {
if ( panel.length) {
that.panels = that.panels.add( panel );
}
- tab.attr( "aria-controls", selector.substring( 1 ) );
+ tab
+ .data( "ui-tabs-aria-controls", tab.attr( "aria-controls" ) )
+ .attr( "aria-controls", selector.substring( 1 ) );
});
},
@@ -290,6 +298,50 @@ $.widget( "ui.tabs", {
this._bind( this.anchors, events );
},
+ _setupHeightStyle: function( heightStyle ) {
+ var maxHeight, overflow,
+ parent = this.element.parent();
+
+ if ( heightStyle === "fill" ) {
+ // IE 6 treats height like minHeight, so we need to turn off overflow
+ // in order to get a reliable height
+ // we use the minHeight support test because we assume that only
+ // browsers that don't support minHeight will treat height as minHeight
+ if ( !$.support.minHeight ) {
+ overflow = parent.css( "overflow" );
+ parent.css( "overflow", "hidden");
+ }
+ maxHeight = parent.height();
+ this.element.siblings( ":visible" ).each(function() {
+ var elem = $( this ),
+ position = elem.css( "position" );
+
+ if ( position === "absolute" || position === "fixed" ) {
+ return;
+ }
+ maxHeight -= elem.outerHeight( true );
+ });
+ if ( overflow ) {
+ parent.css( "overflow", overflow );
+ }
+
+ this.element.children().not( this.panels ).each(function() {
+ maxHeight -= $( this ).outerHeight( true );
+ });
+
+ this.panels.each(function() {
+ $( this ).height( Math.max( 0, maxHeight -
+ $( this ).innerHeight() + $( this ).height() ) );
+ })
+ .css( "overflow", "auto" );
+ } else if ( heightStyle === "auto" ) {
+ maxHeight = 0;
+ this.panels.each(function() {
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+ }).height( maxHeight );
+ }
+ },
+
_eventHandler: function( event ) {
var options = this.options,
active = this.active,
@@ -397,14 +449,8 @@ $.widget( "ui.tabs", {
});
},
- _findActive: function( selector ) {
- if ( typeof selector === "number" ) {
- return this.lis.eq( selector );
- }
- if ( typeof selector === "string" ) {
- return this.anchors.filter( "[href$='" + selector + "']" ).closest( "li" );
- }
- return $();
+ _findActive: function( index ) {
+ return index === false ? $() : this.lis.eq( index );
},
_getIndex: function( index ) {
@@ -448,6 +494,20 @@ $.widget( "ui.tabs", {
}
});
+ this.lis.each(function() {
+ var li = $( this ),
+ prev = li.data( "ui-tabs-aria-controls" );
+ if ( prev ) {
+ li.attr( "aria-controls", prev );
+ } else {
+ li.removeAttr( "aria-controls" );
+ }
+ });
+
+ if ( this.options.heightStyle !== "content" ) {
+ this.panels.css( "height", "" );
+ }
+
return this;
},