1
0
mirror of synced 2025-03-10 22:56:12 +03:00

minor cleanup

This commit is contained in:
Igor Vaynberg 2012-06-12 22:12:53 -07:00
parent 0ccfd4853c
commit 9fc18a9ca8

View File

@ -685,8 +685,7 @@
this.dropdown.css({ this.dropdown.css({
top: offset.top + height, top: offset.top + height,
left: offset.left, left: offset.left,
width: width, width: width
'max-height': 300
}); });
}, },
@ -1014,7 +1013,7 @@
var selection, var selection,
container = this.container, container = this.container,
dropdown = this.dropdown, dropdown = this.dropdown,
containerGroup = $([this.container.get(0), this.dropdown.get(0)]), containers = $([this.container.get(0), this.dropdown.get(0)]),
clickingInside = false, clickingInside = false,
selector = ".select2-choice"; selector = ".select2-choice";
@ -1039,7 +1038,7 @@
} }
})); }));
containerGroup.delegate(selector, "click", this.bind(function (e) { containers.delegate(selector, "click", this.bind(function (e) {
clickingInside = true; clickingInside = true;
if (this.opened()) { if (this.opened()) {
@ -1052,7 +1051,7 @@
clickingInside = false; clickingInside = false;
})); }));
containerGroup.delegate(selector, "keydown", this.bind(function (e) { containers.delegate(selector, "keydown", this.bind(function (e) {
if (!this.enabled || e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) { if (!this.enabled || e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
return; return;
} }
@ -1066,8 +1065,8 @@
killEvent(e); killEvent(e);
} }
})); }));
containerGroup.delegate(selector, "focus", function () { if (this.enabled) { containerGroup.addClass("select2-container-active"); dropdown.addClass("select2-drop-active"); }}); containers.delegate(selector, "focus", function () { if (this.enabled) { containerGroup.addClass("select2-container-active"); dropdown.addClass("select2-drop-active"); }});
containerGroup.delegate(selector, "blur", this.bind(function () { containers.delegate(selector, "blur", this.bind(function () {
if (clickingInside) return; if (clickingInside) return;
if (!this.opened()) this.blur(); if (!this.opened()) this.blur();
})); }));