Permalink
Browse files

fixed: improved unique ID generation

  • Loading branch information...
1 parent aa692bb commit 7932007dc5756b28cbdb6b824f0299a827c61fa8 @fnagel committed Nov 23, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 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;

0 comments on commit 7932007

Please sign in to comment.