From: Felix Nagel Date: Fri, 23 Nov 2012 23:27:46 +0000 (+0100) Subject: fixed: improved unique ID generation X-Git-Tag: selectmenu_v1.4.0~16 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7932007dc5756b28cbdb6b824f0299a827c61fa8;p=jquery-ui.git fixed: improved unique ID generation --- diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 1d79043df..12c676fd5 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -28,13 +28,13 @@ $.widget("ui.selectmenu", { _create: function() { var self = this, o = this.options; - - // set a default id value, generate a new random one if not set by developer - var selectmenuId = ( this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ) ).replace( /(:|\.)/g, '' ) + + // make / set unique id + var selectmenuId = this.element.uniqueId().attr( "id" ); // quick array of button and menu id's this.ids = [ selectmenuId, selectmenuId + '-button', selectmenuId + '-menu' ]; - + // define safe mouseup for future toggling this._safemouseup = true; this.isOpen = false;