]> source.dussan.org Git - jquery-ui.git/commitdiff
fixed: improved unique ID generation
authorFelix Nagel <info@felixnagel.com>
Fri, 23 Nov 2012 23:27:46 +0000 (00:27 +0100)
committerFelix Nagel <info@felixnagel.com>
Fri, 23 Nov 2012 23:27:46 +0000 (00:27 +0100)
ui/jquery.ui.selectmenu.js

index 1d79043df788bfbbfa2f274a6205a4ffb352c05c..12c676fd5a38771b24360ca2f23692c5f5c6417c 100644 (file)
@@ -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;