diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 1d74b0d1c..574f9f8e7 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -37,10 +37,10 @@ $.widget( "ui.selectmenu", { _create: function() { // make / set unique id - var selectmenuId = this.element.uniqueId().attr( 'id' ); + var selectmenuId = this.element.uniqueId().attr( "id" ); // array of button and menu id's - this.ids = { id: selectmenuId, button: selectmenuId + '-button', menu: selectmenuId + '-menu' }; + this.ids = { id: selectmenuId, button: selectmenuId + "-button", menu: selectmenuId + "-menu" }; this._drawButton(); this._on( this.button, this._buttonEvents ); @@ -64,13 +64,13 @@ $.widget( "ui.selectmenu", { }, _drawButton: function() { - var tabindex = this.element.attr( 'tabindex' ); + var tabindex = this.element.attr( "tabindex" ); // fix existing label this.label = $( "label[for='" + this.ids.id + "']" ).attr( "for", this.ids.button ); // catch click event of the label this._on( this.label, { - 'click': function( event ) { + "click": function( event ) { this.button.focus(); event.preventDefault(); } @@ -80,30 +80,32 @@ $.widget( "ui.selectmenu", { this.element.hide(); // create button - this.button = $( '', { - 'class': 'ui-button ui-widget ui-state-default ui-corner-all', - href: '#' + this.ids.id, + this.button = $( "", { + "class": "ui-button ui-widget ui-state-default ui-corner-all", + href: "#" + this.ids.id, tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ), id: this.ids.button, width: this.element.outerWidth(), - role: 'combobox', - 'aria-expanded': false, - 'aria-autocomplete': 'list', - 'aria-owns': this.ids.menu, - 'aria-haspopup': true + role: "combobox", + "aria-expanded": false, + "aria-autocomplete": "list", + "aria-owns": this.ids.menu, + "aria-haspopup": true }); - this.button.prepend( $( '' ) ); + this.button.prepend( $( "", { + "class": "ui-icon " + ( ( this.options.dropdown ) ? "ui-icon-triangle-1-s" : "ui-icon-triangle-2-n-s" ) + })); - this.buttonText = $( '', { - 'class': 'ui-selectmenu-text' , - html: this.element.find( "option:selected" ).text() || ' ' + this.buttonText = $( "", { + "class": "ui-selectmenu-text" , + html: this.element.find( "option:selected" ).text() || " " }) .appendTo( this.button ); // wrap and insert new button - this.buttonWrap = $( '', { - 'class': 'ui-selectmenu-button' + this.buttonWrap = $( "", { + "class": "ui-selectmenu-button" }) .append( this.button ) .insertAfter( this.element ); @@ -114,16 +116,16 @@ $.widget( "ui.selectmenu", { that = this; // create menu portion, append to body - this.menu = $( '