Skip to content
Permalink
Browse files

Selectmenu: create menu items with first opening to increase performance

  • Loading branch information...
fnagel committed Jan 11, 2012
1 parent db4acf6 commit 8c17f74a1e64e134108f790d2527df18284ac9cc
Showing with 6 additions and 1 deletion.
  1. +6 −1 ui/jquery.ui.selectmenu.js
@@ -62,7 +62,6 @@ $.widget( "ui.selectmenu", {
this._bind( this.button, this._buttonEvents );

this._drawMenu();
this.refresh();
},

_drawButton: function() {
@@ -191,6 +190,12 @@ $.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 ) {

3 comments on commit 8c17f74

@jzaefferer

This comment has been minimized.

Copy link
Member

jzaefferer replied Jan 11, 2012

That's an easy fix, nice. Wondering if you could check some other state that refresh initializes, instead of introducing another one.

@fnagel

This comment has been minimized.

Copy link
Member Author

fnagel replied Jan 11, 2012

I could check for an attribute buts that more expensive than an var.

@fnagel

This comment has been minimized.

Copy link
Member Author

fnagel replied Jan 12, 2012

Nahh, it wasn't that easy. A fully initialized menu widget is needed for keyboard control. I needed to add a check in _move, too.

Please sign in to comment.
You can’t perform that action at this time.