diff options
author | Felix Nagel <info@felixnagel.com> | 2012-01-20 00:48:42 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-01-20 00:48:42 +0100 |
commit | 27049fc5dc59522c38376d5c91f9f9a304e16613 (patch) | |
tree | c5ceffa37f4b54b23e6e4c13e3356f82a71a7293 | |
parent | ba73886d3f0ad1c62eea92a7c8858f71cab6a19d (diff) | |
download | jquery-ui-27049fc5dc59522c38376d5c91f9f9a304e16613.tar.gz jquery-ui-27049fc5dc59522c38376d5c91f9f9a304e16613.zip |
Selectmenu: improve initial refresh method call
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 9f5d3db37..081f5386c 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -184,12 +184,6 @@ $.widget( "ui.selectmenu", { }, open: function( event ) { - // init menu when initial opened - if ( !this.wasOpen ) { - this.refresh(); - this.wasOpen = true; - } - var currentItem = this._getSelectedItem(); if ( !this.options.disabled ) { @@ -284,11 +278,6 @@ $.widget( "ui.selectmenu", { }, _move: function( direction, event ) { - // init menu when not done yet - if ( !this.wasOpen ) { - this.refresh(); - this.wasOpen = true; - } if ( direction == "first" || direction == "last" ) { // set focus manually for first or last item this.menu.menu( "focus", event, this.menu.find( "li" ).not( '.ui-selectmenu-optgroup' )[ direction ]() ); @@ -320,6 +309,11 @@ $.widget( "ui.selectmenu", { }, _buttonEvents: { + // init Menu on first focus + focus: function( event ) { + this.refresh(); + this.button.unbind( "focus." + this.widgetName ) + }, click: function( event ) { this._toggle( event ); event.preventDefault(); |