Merge branch 'master' into interactions

This commit is contained in:
Scott González 2012-01-31 18:19:51 -05:00
commit b110de98e1
27 changed files with 313 additions and 89 deletions

View File

@ -50,6 +50,10 @@
if ( ( Math.abs( pX - cX ) + Math.abs( pY - cY ) ) < cfg.sensitivity ) {
clear();
event.type = "hoverintent";
// prevent accessing the original event since the new event
// is fired asynchronously and the old event is no longer
// usable (#6028)
event.originalEvent = {};
jQuery.event.handle.apply( self, args );
} else {
pX = cX;

View File

@ -226,9 +226,9 @@
return false;
});
});
});
}, "html" );
}
});
}, "html" );
}
function updateDemoNotes() {

View File

@ -45,7 +45,7 @@ $.extend( $.simulate.prototype, {
}
},
mouseEvent: function( type, options ) {
var evt;
var evt, eventDoc, doc, body;
var e = $.extend({
bubbles: true,
cancelable: (type !== "mousemove"),
@ -71,6 +71,30 @@ $.extend( $.simulate.prototype, {
e.screenX, e.screenY, e.clientX, e.clientY,
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
e.button, e.relatedTarget || document.body.parentNode );
// IE 9+ creates events with pageX and pageY set to 0.
// Trying to modify the properties throws an error,
// so we define getters to return the correct values.
if ( evt.pageX === 0 && evt.pageY === 0 && Object.defineProperty ) {
eventDoc = evt.relatedTarget.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
Object.defineProperty( evt, "pageX", {
get: function() {
return e.clientX +
( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
( doc && doc.clientLeft || body && body.clientLeft || 0 );
}
});
Object.defineProperty( evt, "pageY", {
get: function() {
return e.clientY +
( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
( doc && doc.clientTop || body && body.clientTop || 0 );
}
});
}
} else if ( document.createEventObject ) {
evt = document.createEventObject();
$.extend( evt, e );

View File

@ -2,6 +2,45 @@
module( "accordion: events", accordion_setupTeardown() );
test( "create", function() {
expect( 10 );
var element = $( "#list1" ),
headers = element.children( "h3" ),
contents = headers.next();
element.accordion({
create: function( event, ui ) {
equals( ui.header.size(), 1, "header size" );
strictEqual( ui.header[ 0 ], headers[ 0 ], "header" );
equals( ui.content.size(), 1, "content size" );
strictEqual( ui.content[ 0 ], contents[ 0 ], "content" );
}
});
element.accordion( "destroy" );
element.accordion({
active: 2,
create: function( event, ui ) {
equals( ui.header.size(), 1, "header size" );
strictEqual( ui.header[ 0 ], headers[ 2 ], "header" );
equals( ui.content.size(), 1, "content size" );
strictEqual( ui.content[ 0 ], contents[ 2 ], "content" );
}
});
element.accordion( "destroy" );
element.accordion({
active: false,
collapsible: true,
create: function( event, ui ) {
equals( ui.header.size(), 0, "header size" );
equals( ui.content.size(), 0, "content size" );
}
});
element.accordion( "destroy" );
});
test( "beforeActivate", function() {
expect( 38 );
var element = $( "#list1" ).accordion({

View File

@ -255,7 +255,7 @@ test( "{ icons: false }", function() {
var element = $( "#list1" );
function icons( on ) {
deepEqual( element.find( "span.ui-icon").length, on ? 3 : 0 );
deepEqual( element.hasClass( "ui-accordion-icons" ), on );
deepEqual( element.find( ".ui-accordion-header.ui-accordion-icons" ).length, on ? 3 : 0 );
}
element.accordion();
icons( true );

View File

@ -162,8 +162,4 @@ test( "allow form submit on enter when menu is not active", function() {
}
})();
(function() {
})();
}( jQuery ) );

View File

@ -9,15 +9,19 @@ test( "destroy", function() {
});
});
test( "search", function() {
expect( 3 );
test( "search, close", function() {
expect( 6 );
var data = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl" ],
element = $( "#autocomplete" ).autocomplete({
source: data,
minLength: 0
}),
menu = element.autocomplete( "widget" );
ok( menu.is( ":hidden" ), "menu is hidden on init" );
element.autocomplete( "search" );
ok( menu.is( ":visible" ), "menu is visible after search" );
equal( menu.find( ".ui-menu-item" ).length, data.length, "all items for a blank search" );
element.val( "has" ).autocomplete( "search" );
@ -25,6 +29,9 @@ test( "search", function() {
element.autocomplete( "search", "ja" );
equal( menu.find( ".ui-menu-item" ).length, 2, "only java and javascript for 'ja'" );
element.autocomplete( "close" );
ok( menu.is( ":hidden" ), "menu is hidden after close" );
});
}( jQuery ) );

View File

@ -9,27 +9,27 @@ module("menu: core");
test("accessibility", function () {
expect(5);
var ac = $('#menu1').menu();
var menu = $('#menu1').menu();
var item0 = $("li:eq(0) a");
ok( ac.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class");
equals( ac.attr("role"), "menu", "main role");
ok( !ac.attr("aria-activedescendant"), "aria attribute not yet active");
ok( menu.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class");
equals( menu.attr("role"), "menu", "main role");
ok( !menu.attr("aria-activedescendant"), "aria attribute not yet active");
var item = ac.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end();
ac.menu( "focus", $.Event(), item );
equals( ac.attr("aria-activedescendant"), "xid", "aria attribute, id from dom");
var item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end();
menu.menu( "focus", $.Event(), item );
equals( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom");
var item = ac.find( "li:last" );
ac.menu( "focus", $.Event(), item );
equals( ac.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id");
var item = menu.find( "li:last" );
menu.menu( "focus", $.Event(), item );
equals( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id");
});
test("items class and role", function () {
var ac = $('#menu1').menu();
expect(1 + 5 * $("li",ac).length);
ok( ($("li",ac).length > 0 ), "number of menu items");
$("li",ac).each(function(item) {
var menu = $('#menu1').menu();
expect(1 + 5 * $("li",menu).length);
ok( ($("li",menu).length > 0 ), "number of menu items");
$("li",menu).each(function(item) {
ok( $(this).hasClass("ui-menu-item"), "menu item ("+ item + ") class for item");
equals( $(this).attr("role"), "presentation", "menu item ("+ item + ") role");
equals( $("a", this).attr("role"), "menuitem", "menu item ("+ item + ") role");

View File

@ -1,12 +1,11 @@
commonWidgetTests( "menu", {
defaults: {
disabled: false,
menus: "ul",
position: {
my: "left top",
at: "right top"
},
menus: "ul",
trigger: null,
// callbacks
create: null

View File

@ -7,7 +7,7 @@ module("menu: events");
test("handle click on menu", function() {
expect(1);
var ac = $('#menu1').menu({
var menu = $('#menu1').menu({
select: function(event, ui) {
menu_log();
}
@ -15,15 +15,15 @@ test("handle click on menu", function() {
menu_log("click",true);
menu_click($('#menu1'),"1");
menu_log("afterclick");
menu_click( ac,"2");
menu_click( menu,"2");
menu_click($('#menu1'),"3");
menu_click( ac,"1");
menu_click( menu,"1");
equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
});
test("handle click on custom item menu", function() {
expect(1);
var ac = $('#menu5').menu({
var menu = $('#menu5').menu({
select: function(event, ui) {
menu_log();
},
@ -32,9 +32,9 @@ test("handle click on custom item menu", function() {
menu_log("click",true);
menu_click($('#menu5'),"1");
menu_log("afterclick");
menu_click( ac,"2");
menu_click( menu,"2");
menu_click($('#menu5'),"3");
menu_click( ac,"1");
menu_click( menu,"1");
equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
});

View File

@ -5,6 +5,36 @@
module("menu: methods");
test( "enable/disable", function() {
expect( 3 );
var menu = $( "#menu1" ).menu({
select: function(event, ui) {
menu_log();
}
});
menu.menu("disable");
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
menu_log("click",true);
menu_click(menu,"1");
menu_log("afterclick");
menu.menu("enable");
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
menu_log("click");
menu_click(menu,"1");
menu_log("afterclick");
equals( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid.");
});
test( "refresh", function() {
expect( 3 );
var menu = $( "#menu1" ).menu();
equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
menu.append("<li><a href='#'>test item</a></li>").menu("refresh");
equals(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items");
menu.find(".ui-menu-item:last").remove().end().menu("refresh");
equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
});
test("destroy", function() {
domEqual("#menu1", function() {
$("#menu1").menu().menu("destroy");

View File

@ -5,6 +5,34 @@
module("menu: options");
test( "{ disabled: true }", function() {
expect( 2 );
var menu = $( "#menu1" ).menu({
disabled: true,
select: function(event, ui) {
menu_log();
}
});
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
menu_log("click",true);
menu_click(menu,"1");
menu_log("afterclick");
equals( $("#log").html(), "afterclick,click,", "Click order not valid.");
});
test( "{ disabled: false }", function() {
expect( 2 );
var menu = $( "#menu1" ).menu({
disabled: false,
select: function(event, ui) {
menu_log();
}
});
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
menu_log("click",true);
menu_click(menu,"1");
menu_log("afterclick");
equals( $("#log").html(), "afterclick,1,click,", "Click order not valid.");
});
})(jQuery);

View File

@ -2,6 +2,45 @@
module( "tabs: events" );
test( "create", function() {
expect( 10 );
var element = $( "#tabs1" ),
tabs = element.find( "ul a" ),
panels = element.children( "div" );
element.tabs({
create: function( event, ui ) {
equals( ui.tab.size(), 1, "tab size" );
strictEqual( ui.tab[ 0 ], tabs[ 0 ], "tab" );
equals( ui.panel.size(), 1, "panel size" );
strictEqual( ui.panel[ 0 ], panels[ 0 ], "panel" );
}
});
element.tabs( "destroy" );
element.tabs({
active: 2,
create: function( event, ui ) {
equals( ui.tab.size(), 1, "tab size" );
strictEqual( ui.tab[ 0 ], tabs[ 2 ], "tab" );
equals( ui.panel.size(), 1, "panel size" );
strictEqual( ui.panel[ 0 ], panels[ 2 ], "panel" );
}
});
element.tabs( "destroy" );
element.tabs({
active: false,
collapsible: true,
create: function( event, ui ) {
equals( ui.tab.size(), 0, "tab size" );
equals( ui.panel.size(), 0, "panel size" );
}
});
element.tabs( "destroy" );
});
test( "beforeActivate", function() {
expect( 38 );

View File

@ -261,6 +261,21 @@ test( "._getCreateOptions()", function() {
$( "<div>" ).testWidget({ option2: "value2" });
});
test( "._getCreateEventData()", function() {
expect( 1 );
var data = { foo: "bar" };
$.widget( "ui.testWidget", {
_getCreateEventData: function() {
return data;
}
});
$( "<div>" ).testWidget({
create: function( event, ui ) {
strictEqual( ui, data, "event data" );
}
});
});
test( "re-init", function() {
var div = $( "<div>" ),
actions = [];

View File

@ -9,10 +9,13 @@
*/
/* IE/Win - Fix animation bug - #4615 */
.ui-accordion { width: 100%; }
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 2px; zoom: 1; }
.ui-accordion .ui-accordion-header-active,
.ui-accordion .ui-accordion .ui-accordion-header-active { border-bottom: 0; }
.ui-accordion .ui-accordion-heading { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
.ui-accordion-icons .ui-accordion-heading { padding-left: 2.2em; }
.ui-accordion-icons a.ui-accordion-heading { padding-left: 2.2em; }
.ui-accordion-noicons a.ui-accordion-heading { padding-left: .7em; }
.ui-accordion-icons .ui-accordion-icons a.ui-accordion-heading { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content-active { display: block; }

View File

@ -1,23 +1,23 @@
/* Korean initialisation for the jQuery calendar extension. */
/* Written by DaeKwon Kang (ncrash.dk@gmail.com). */
/* Written by DaeKwon Kang (ncrash.dk@gmail.com), Edited by Genie. */
jQuery(function($){
$.datepicker.regional['ko'] = {
closeText: '닫기',
prevText: '이전달',
nextText: '다음달',
currentText: '오늘',
monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
'7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
'7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
dayNames: ['일','월','화','수','목','금','토'],
monthNames: ['1월','2월','3월','4월','5월','6월',
'7월','8월','9월','10월','11월','12월'],
monthNamesShort: ['1월','2월','3월','4월','5월','6월',
'7월','8월','9월','10월','11월','12월'],
dayNames: ['일요일','월요일','화요일','수요일','목요일','금요일','토요일'],
dayNamesShort: ['일','월','화','수','목','금','토'],
dayNamesMin: ['일','월','화','수','목','금','토'],
weekHeader: 'Wk',
dateFormat: 'yy-mm-dd',
firstDay: 0,
isRTL: false,
showMonthAfterYear: false,
showMonthAfterYear: true,
yearSuffix: '년'};
$.datepicker.setDefaults($.datepicker.regional['ko']);
});

View File

@ -14,7 +14,7 @@ jQuery(function($){
dayNamesShort: ['Нед','Пон','Вто','Сре','Чет','Пет','Саб'],
dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Са'],
weekHeader: 'Сед',
dateFormat: 'dd/mm/yy',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,

View File

@ -1,4 +1,4 @@
/* Dutch (Belgium) initialisation for the jQuery UI date picker plugin. */
/* Dutch (Belgium) initialisation for the jQuery UI date picker plugin. */
/* David De Sloovere @DavidDeSloovere */
jQuery(function($){
$.datepicker.regional['nl-BE'] = {

View File

@ -13,7 +13,6 @@
*/
(function( $, undefined ) {
// TODO: use ui-accordion-header-active class and fix styling
$.widget( "ui.accordion", {
version: "@VERSION",
options: {
@ -58,7 +57,7 @@ $.widget( "ui.accordion", {
options.active += this.headers.length;
}
self.active = self._findActive( options.active )
.addClass( "ui-state-default ui-state-active" )
.addClass( "ui-accordion-header-active ui-state-active" )
.toggleClass( "ui-corner-all" )
.toggleClass( "ui-corner-top" );
self.active.next().addClass( "ui-accordion-content-active" );
@ -104,6 +103,13 @@ $.widget( "ui.accordion", {
this._setupEvents( options.event );
},
_getCreateEventData: function() {
return {
header: this.active,
content: !this.active.length ? $() : this.active.next()
};
},
_createIcons: function() {
var icons = this.options.icons;
if ( icons ) {
@ -113,13 +119,15 @@ $.widget( "ui.accordion", {
this.active.children( ".ui-accordion-header-icon" )
.removeClass( icons.header )
.addClass( icons.activeHeader );
this.element.addClass( "ui-accordion-icons" );
this.headers.addClass( "ui-accordion-icons" );
}
},
_destroyIcons: function() {
this.headers.children( ".ui-accordion-header-icon" ).remove();
this.element.removeClass( "ui-accordion-icons" );
this.headers
.removeClass( "ui-accordion-icons" )
.children( ".ui-accordion-header-icon" )
.remove();
},
_destroy: function() {
@ -131,7 +139,7 @@ $.widget( "ui.accordion", {
// clean up headers
this.headers
.unbind( ".accordion" )
.removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
.removeClass( "ui-accordion-header ui-accordion-header-active ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
.removeAttr( "role" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-selected" )
@ -335,15 +343,15 @@ $.widget( "ui.accordion", {
// switch classes
active
.removeClass( "ui-state-active ui-corner-top" )
.addClass( "ui-state-default ui-corner-all" )
.removeClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
.addClass( "ui-corner-all" )
.children( ".ui-accordion-header-icon" )
.removeClass( options.icons.activeHeader )
.addClass( options.icons.header );
if ( !clickedIsActive ) {
clicked
.removeClass( "ui-state-default ui-corner-all" )
.addClass( "ui-state-active ui-corner-top" )
.removeClass( "ui-corner-all" )
.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
.children( ".ui-accordion-header-icon" )
.removeClass( options.icons.header )
.addClass( options.icons.activeHeader );
@ -439,7 +447,11 @@ $.extend( $.ui.accordion, {
}
var showOverflow = options.toShow.css( "overflow" ),
showOverflowX = options.toHide.css( "overflowX" ),
showOverflowY = options.toHide.css( "overflowY" ),
hideOverflow = options.toHide.css( "overflow" ),
hideOverflowX = options.toHide.css( "overflowX" ),
hideOverflowY = options.toHide.css( "overflowY" ),
percentDone = 0,
showProps = {},
hideProps = {},
@ -522,9 +534,15 @@ $.extend( $.ui.accordion, {
complete: function() {
options.toShow.css({
width: originalWidth,
overflow: showOverflow
overflow: showOverflow,
overflowX: showOverflowX,
overflowY: showOverflowY
});
options.toHide.css({
overflow: hideOverflow,
overflowX: hideOverflowX,
overflowY: hideOverflowY
});
options.toHide.css( "overflow", hideOverflow );
options.complete();
}
});

View File

@ -58,7 +58,9 @@ $.widget( "ui.button", {
.bind( "reset.button", formResetHandler );
if ( typeof this.options.disabled !== "boolean" ) {
this.options.disabled = this.element.prop( "disabled" );
this.options.disabled = !!this.element.prop( "disabled" );
} else {
this.element.prop( "disabled", this.options.disabled );
}
this._determineButtonType();
@ -74,10 +76,6 @@ $.widget( "ui.button", {
options.label = this.buttonElement.html();
}
if ( this.element.is( ":disabled" ) ) {
options.disabled = true;
}
this.buttonElement
.addClass( baseClasses )
.attr( "role", "button" )

View File

@ -223,6 +223,11 @@ $(function() {
var body = document.body,
div = body.appendChild( div = document.createElement( "div" ) );
// access offsetHeight before setting the style to prevent a layout bug
// in IE 9 which causes the elemnt to continue to take up space even
// after it is removed from the DOM (#8026)
div.offsetHeight;
$.extend( div.style, {
minHeight: "100px",
height: "auto",

View File

@ -233,7 +233,10 @@ $.extend(Datepicker.prototype, {
inst.trigger.click(function() {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
$.datepicker._hideDatepicker();
else
else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
$.datepicker._hideDatepicker();
$.datepicker._showDatepicker(input[0]);
} else
$.datepicker._showDatepicker(input[0]);
return false;
});

View File

@ -24,8 +24,7 @@ $.widget( "ui.menu", {
position: {
my: "left top",
at: "right top"
},
trigger: null
}
},
_create: function() {
this.activeMenu = this.element;
@ -46,6 +45,9 @@ $.widget( "ui.menu", {
event.preventDefault();
}
}, this));
if ( this.options.disabled ) {
this.element.addClass( "ui-state-disabled" );
}
this._bind({
// Prevent focus from sticking to links inside menu after clicking
// them (focus should always stay on UL during navigation).

View File

@ -429,7 +429,7 @@ $.ui.position = {
background: "none"
};
if ( body ) {
jQuery.extend( testElementStyle, {
$.extend( testElementStyle, {
position: "absolute",
left: "-1000px",
top: "-1000px"

View File

@ -17,6 +17,7 @@
$.widget("ui.sortable", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "sort",
ready: false,
options: {
appendTo: "parent",
axis: false,
@ -59,6 +60,9 @@ $.widget("ui.sortable", $.ui.mouse, {
//Initialize mouse events for interaction
this._mouseInit();
//We're ready to go
this.ready = true
},
destroy: function() {
@ -571,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, {
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
var connectWith = this._connectWith();
if(connectWith) {
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
for (var i = connectWith.length - 1; i >= 0; i--){
var cur = $(connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){

27
ui/jquery.ui.tabs.js vendored
View File

@ -13,23 +13,20 @@
*/
(function( $, undefined ) {
var tabId = 0;
var tabId = 0,
rhash = /#.*$/;
function getNextTabId() {
return ++tabId;
}
var isLocal = (function() {
var rhash = /#.*$/,
currentPage = location.href.replace( rhash, "" );
return function( anchor ) {
var isLocal = function( anchor ) {
// clone the node to work around IE 6 not normalizing the href property
// if it's manually set, i.e., a.href = "#foo" kills the normalization
anchor = anchor.cloneNode( false );
return anchor.hash.length > 1 &&
anchor.href.replace( rhash, "" ) === currentPage;
anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
};
})();
$.widget( "ui.tabs", {
version: "@VERSION",
@ -123,6 +120,13 @@ $.widget( "ui.tabs", {
}
},
_getCreateEventData: function() {
return {
tab: this.active,
panel: !this.active.length ? $() : this._getPanelForTab( this.active )
};
},
_setOption: function( key, value ) {
if ( key == "active" ) {
// _activate() will handle invalid values and update this.options
@ -212,7 +216,7 @@ $.widget( "ui.tabs", {
_processTabs: function() {
var self = this;
this.list = this.element.find( "ol,ul" ).eq( 0 );
this.list = this._getList();
this.lis = $( " > li:has(a[href])", this.list );
this.anchors = this.lis.map(function() {
return $( "a", this )[ 0 ];
@ -244,6 +248,11 @@ $.widget( "ui.tabs", {
});
},
// allow overriding how to find the list for rare usage scenarios (#7715)
_getList: function() {
return this.element.find( "ol,ul" ).eq( 0 );
},
_createPanel: function( id ) {
return $( "<div></div>" )
.attr( "id", id )

View File

@ -204,10 +204,11 @@ $.Widget.prototype = {
}
this._create();
this._trigger( "create" );
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,