Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Selectmenu: create menu items with first opening to increase performance

  • Loading branch information...
commit 8c17f74a1e64e134108f790d2527df18284ac9cc 1 parent db4acf6
@fnagel fnagel authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 ui/jquery.ui.selectmenu.js
View
7 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
Owner

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

@fnagel
Collaborator

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

@fnagel
Collaborator

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.
Something went wrong with that request. Please try again.