some code cleanup. fixes #269
This commit is contained in:
parent
00058ab315
commit
ab1a8b93bf
@ -93,7 +93,7 @@
|
|||||||
nextUid=(function() { var counter=1; return function() { return counter++; }; }());
|
nextUid=(function() { var counter=1; return function() { return counter++; }; }());
|
||||||
|
|
||||||
function escapeMarkup(markup) {
|
function escapeMarkup(markup) {
|
||||||
if (typeof(markup) === "string") {
|
if (markup && typeof(markup) === "string") {
|
||||||
return markup.replace("&", "&");
|
return markup.replace("&", "&");
|
||||||
} else {
|
} else {
|
||||||
return markup;
|
return markup;
|
||||||
@ -393,7 +393,7 @@
|
|||||||
*/
|
*/
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$(document).delegate("*", "mousedown touchend", function (e) {
|
$(document).delegate("*", "mousedown touchend", function (e) {
|
||||||
var target = $(e.target).closest("div.select2-container").get(0);
|
var target = $(e.target).closest("div.select2-container").get(0), attr;
|
||||||
if (target) {
|
if (target) {
|
||||||
$(document).find("div.select2-container-active").each(function () {
|
$(document).find("div.select2-container-active").each(function () {
|
||||||
if (this !== target) $(this).data("select2").blur();
|
if (this !== target) $(this).data("select2").blur();
|
||||||
@ -406,8 +406,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
target=$(e.target);
|
target=$(e.target);
|
||||||
if ("LABEL" === e.target.tagName && target.attr("for").length > 0) {
|
attr = target.attr("for");
|
||||||
target = $("#"+target.attr("for"));
|
if ("LABEL" === e.target.tagName && attr && attr.length > 0) {
|
||||||
|
target = $("#"+attr);
|
||||||
target = target.data("select2");
|
target = target.data("select2");
|
||||||
if (target !== undefined) { target.focus(); e.preventDefault();}
|
if (target !== undefined) { target.focus(); e.preventDefault();}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user