Parcourir la source

Restore previously selected option when updating a drop-down list.

Roberto Agostino Vitillo il y a 12 ans
Parent
commit
40e10d801e
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      editor/js/libs/ui.js

+ 3 - 0
editor/js/libs/ui.js

@@ -267,6 +267,7 @@ UI.Select.prototype.setMultiple = function ( boolean ) {
 };
 
 UI.Select.prototype.setOptions = function ( options ) {
+  var selected = this.dom.value;
 
 	while ( this.dom.children.length > 0 ) {
 
@@ -283,6 +284,8 @@ UI.Select.prototype.setOptions = function ( options ) {
 
 	}
 
+  this.dom.value = selected;
+
 	return this;
 
 };