CollapsibleTabs: Avoid Sizzle selectors
Change-Id: I199a11602df50f2120dce6f861bb4b6260ab9380
This commit is contained in:
parent
a5c492414a
commit
a4f61a832e
|
@ -96,7 +96,9 @@
|
||||||
},
|
},
|
||||||
handleResize: function () {
|
handleResize: function () {
|
||||||
$.collapsibleTabs.instances.forEach( function ( $el ) {
|
$.collapsibleTabs.instances.forEach( function ( $el ) {
|
||||||
var data = $.collapsibleTabs.getSettings( $el );
|
var $tab,
|
||||||
|
data = $.collapsibleTabs.getSettings( $el );
|
||||||
|
|
||||||
if ( data.shifting ) {
|
if ( data.shifting ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -105,24 +107,21 @@
|
||||||
if ( $el.children( data.collapsible ).length && data.collapseCondition() ) {
|
if ( $el.children( data.collapsible ).length && data.collapseCondition() ) {
|
||||||
$el.trigger( 'beforeTabCollapse' );
|
$el.trigger( 'beforeTabCollapse' );
|
||||||
// move the element to the dropdown menu
|
// move the element to the dropdown menu
|
||||||
$.collapsibleTabs.moveToCollapsed( $el.children( data.collapsible + ':last' ) );
|
$.collapsibleTabs.moveToCollapsed( $el.children( data.collapsible ).last() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tab = $( data.collapsedContainer ).children( data.collapsible ).first();
|
||||||
// if there are still moveable items in the dropdown menu,
|
// if there are still moveable items in the dropdown menu,
|
||||||
// and there is sufficient space to place them in the tab container
|
// and there is sufficient space to place them in the tab container
|
||||||
if (
|
if (
|
||||||
$( data.collapsedContainer + ' ' + data.collapsible ).length &&
|
$( data.collapsedContainer + ' ' + data.collapsible ).length &&
|
||||||
data.expandCondition(
|
data.expandCondition(
|
||||||
$.collapsibleTabs.getSettings(
|
$.collapsibleTabs.getSettings( $tab ).expandedWidth
|
||||||
$( data.collapsedContainer ).children(
|
|
||||||
data.collapsible + ':first' )
|
|
||||||
).expandedWidth
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// move the element from the dropdown to the tab
|
// move the element from the dropdown to the tab
|
||||||
$el.trigger( 'beforeTabExpand' );
|
$el.trigger( 'beforeTabExpand' );
|
||||||
$.collapsibleTabs
|
$.collapsibleTabs.moveToExpanded( $tab );
|
||||||
.moveToExpanded( data.collapsedContainer + ' ' + data.collapsible + ':first' );
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
@ -156,9 +155,8 @@
|
||||||
rAF( $.collapsibleTabs.handleResize );
|
rAF( $.collapsibleTabs.handleResize );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
moveToExpanded: function ( ele ) {
|
moveToExpanded: function ( $moving ) {
|
||||||
var data, expContainerSettings, $target, expandedWidth,
|
var data, expContainerSettings, $target, expandedWidth;
|
||||||
$moving = $( ele );
|
|
||||||
|
|
||||||
data = $.collapsibleTabs.getSettings( $moving );
|
data = $.collapsibleTabs.getSettings( $moving );
|
||||||
if ( !data ) {
|
if ( !data ) {
|
||||||
|
@ -171,7 +169,7 @@
|
||||||
expContainerSettings.shifting = true;
|
expContainerSettings.shifting = true;
|
||||||
|
|
||||||
// grab the next appearing placeholder so we can use it for replacing
|
// grab the next appearing placeholder so we can use it for replacing
|
||||||
$target = $( data.expandedContainer ).find( 'span.placeholder:first' );
|
$target = $( data.expandedContainer ).find( 'span.placeholder' ).first();
|
||||||
expandedWidth = data.expandedWidth;
|
expandedWidth = data.expandedWidth;
|
||||||
$moving.css( 'position', 'relative' ).css( ( isRTL ? 'right' : 'left' ), 0 ).css( 'width', '1px' );
|
$moving.css( 'position', 'relative' ).css( ( isRTL ? 'right' : 'left' ), 0 ).css( 'width', '1px' );
|
||||||
$target.replaceWith(
|
$target.replaceWith(
|
||||||
|
|
Loading…
Reference in New Issue