Skip to content
Permalink
Browse files

Selectmenu: Fall back to .ui-front searching for empty jQuery objects

Fixes #9757
  • Loading branch information
jzaefferer committed Feb 21, 2014
1 parent 8a71d0f commit fa99e23d18e6a835f866261e56398fa4f443edab
Showing with 7 additions and 2 deletions.
  1. +6 −1 tests/unit/selectmenu/selectmenu_options.js
  2. +1 −1 ui/selectmenu.js
@@ -3,7 +3,7 @@
module( "selectmenu: options" );

test( "appendTo another element", function () {
expect( 8 );
expect( 9 );

var detached = $( "<div>" ),
element = $( "#speed" ).selectmenu();
@@ -21,6 +21,11 @@ test( "appendTo another element", function () {
element.selectmenu();
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" );
element.selectmenu( "destroy" );

element.selectmenu({
appendTo: $()
});
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" );
$( "#selectmenu-wrap2" ).removeClass( "ui-front" );

element.selectmenu().selectmenu( "option", "appendTo", "#selectmenu-wrap1" );
@@ -474,7 +474,7 @@ return $.widget( "ui.selectmenu", {
this.document.find( element ).eq( 0 );
}

if ( !element ) {
if ( !element || !element[ 0 ] ) {
element = this.element.closest( ".ui-front" );
}

0 comments on commit fa99e23

Please sign in to comment.
You can’t perform that action at this time.