mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: improve id generation
This commit is contained in:
parent
0264f07ad5
commit
60eed79390
10
ui/jquery.ui.selectmenu.js
vendored
10
ui/jquery.ui.selectmenu.js
vendored
@ -40,7 +40,11 @@ $.widget( "ui.selectmenu", {
|
|||||||
|
|
||||||
_create: function() {
|
_create: function() {
|
||||||
var selectmenuId = this.element.uniqueId().attr( "id" );
|
var selectmenuId = this.element.uniqueId().attr( "id" );
|
||||||
this.ids = { id: selectmenuId, button: selectmenuId + "-button", menu: selectmenuId + "-menu" };
|
this.ids = {
|
||||||
|
element: selectmenuId,
|
||||||
|
button: selectmenuId + "-button",
|
||||||
|
menu: selectmenuId + "-menu"
|
||||||
|
};
|
||||||
|
|
||||||
this._drawButton();
|
this._drawButton();
|
||||||
this._drawMenu();
|
this._drawMenu();
|
||||||
@ -56,7 +60,7 @@ $.widget( "ui.selectmenu", {
|
|||||||
var tabindex = this.element.attr( "tabindex" );
|
var tabindex = this.element.attr( "tabindex" );
|
||||||
|
|
||||||
// fix existing label
|
// fix existing label
|
||||||
this.label = $( "label[for='" + this.ids.id + "']" ).attr( "for", this.ids.button );
|
this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
|
||||||
this._on( this.label, {
|
this._on( this.label, {
|
||||||
"click": function( event ) {
|
"click": function( event ) {
|
||||||
this.button.focus();
|
this.button.focus();
|
||||||
@ -461,7 +465,7 @@ $.widget( "ui.selectmenu", {
|
|||||||
this.button.remove();
|
this.button.remove();
|
||||||
this.element.show();
|
this.element.show();
|
||||||
this.element.removeUniqueId();
|
this.element.removeUniqueId();
|
||||||
this.label.attr( "for", this.ids.id );
|
this.label.attr( "for", this.ids.element );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user