From 27049fc5dc59522c38376d5c91f9f9a304e16613 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Fri, 20 Jan 2012 00:48:42 +0100 Subject: Selectmenu: improve initial refresh method call --- ui/jquery.ui.selectmenu.js | 16 +++++----------- 1 file 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(); -- cgit v1.2.3