aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/selectmenu/default.html8
-rw-r--r--tests/visual/selectmenu/disabled.html6
-rw-r--r--ui/jquery.ui.selectmenu.js15
3 files changed, 17 insertions, 12 deletions
diff --git a/demos/selectmenu/default.html b/demos/selectmenu/default.html
index eecc25d12..8e481ea63 100644
--- a/demos/selectmenu/default.html
+++ b/demos/selectmenu/default.html
@@ -17,11 +17,13 @@
$('select#speed').selectmenu({
dropdown: false
});
- $('select#number').selectmenu({
- dropdown: false,
- wrapperElement: '<div class="overflow"/>'
+ var withOverflow = $('select#number').selectmenu({
+ dropdown: false
});
+ withOverflow.selectmenu("widget").addClass("overflow");
+
$('select#files').selectmenu();
+
});
</script>
<style>
diff --git a/tests/visual/selectmenu/disabled.html b/tests/visual/selectmenu/disabled.html
index b096f95dd..a76cc7001 100644
--- a/tests/visual/selectmenu/disabled.html
+++ b/tests/visual/selectmenu/disabled.html
@@ -17,10 +17,10 @@
$('select#speed').selectmenu({
dropdown: false
});
- $('select#number').selectmenu({
- dropdown: false,
- wrapperElement: '<div class="overflow"/>'
+ var withOverflow = $('select#number').selectmenu({
+ dropdown: false
});
+ withOverflow.selectmenu("widget").addClass("overflow");
$('select#files').selectmenu();
var files2 = $('select#files2').selectmenu();
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index 155896034..3b6f84946 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -21,7 +21,6 @@ $.widget( "ui.selectmenu", {
defaultElement: "<select>",
options: {
dropdown: true,
- wrapperElement: "<div />",
appendTo: "body",
position: {
my: "left top",
@@ -46,7 +45,7 @@ $.widget( "ui.selectmenu", {
// quick array of button and menu id's
that.ids = [ selectmenuId, selectmenuId + '-button', selectmenuId + '-menu' ];
- // set current value
+ // set current value
if ( options.value ) {
that.element[0].value = options.value;
} else {
@@ -110,7 +109,7 @@ $.widget( "ui.selectmenu", {
});
// wrap and insert new button
- that.newelementWrap = $( options.wrapperElement )
+ that.newelementWrap = $( '<div />' )
.append( that.newelement )
.insertAfter( that.element );
},
@@ -150,7 +149,7 @@ $.widget( "ui.selectmenu", {
});
// wrap list
- that.listWrap = $( options.wrapperElement )
+ that.listWrap = $( '<div />' )
.addClass( that.widgetBaseClass + '-menu' )
.width( setWidth )
.append( that.list )
@@ -297,7 +296,7 @@ $.widget( "ui.selectmenu", {
li.append( $( "<a />", {
text: item.label,
href: '#'
- })
+ })
);
}
@@ -305,7 +304,7 @@ $.widget( "ui.selectmenu", {
},
_move: function( key, event ) {
- // TODO this focus is needed to make the select below work,
+ // TODO this focus is needed to make the select below work,
// but should be removed as its fires an unwanted focus event
if ( !this.opened ) {
this.list.menu( "focus", event, this._getSelectedItem() );
@@ -405,6 +404,10 @@ $.widget( "ui.selectmenu", {
}
},
+ widget: function() {
+ return this.newelementWrap.add( this.listWrap );
+ },
+
_initSource: function() {
var data = [];
$.each( this.element.find( 'option' ), function( index, item ) {