Просмотр исходного кода

prevent opening of a disabled select via api. fixes #1272

Igor Vaynberg 12 лет назад
Родитель
Сommit
5762b85dd2
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      select2.js

+ 2 - 2
select2.js

@@ -963,8 +963,6 @@ the specific language governing permissions and limitations under the Apache Lic
 
                 // sync enabled state
 
-                //console.log("sync enabled: ", this._enabled, "readonly: ", this._readonly);
-
                 var disabled = el.prop("disabled");
                 if (disabled === undefined) disabled = false;
                 this.enable(!disabled);
@@ -1161,6 +1159,8 @@ the specific language governing permissions and limitations under the Apache Lic
 
             if (this.opened()) return false;
 
+            if (this._enabled === false || this._readonly === true) return false;
+
             event = $.Event("select2-opening");
             this.opts.element.trigger(event);
             return !event.isDefaultPrevented();