diff --git a/select2.js b/select2.js index 49820ad1..0ec9599a 100644 --- a/select2.js +++ b/select2.js @@ -1432,7 +1432,7 @@ the specific language governing permissions and limitations under the Apache Lic // single createContainer: function () { - var container = $(document.createElement("div").attr({ + var container = $(document.createElement("div")).attr({ "class": "select2-container" }).html([ " ", @@ -1445,7 +1445,7 @@ the specific language governing permissions and limitations under the Apache Lic " " , " " , - ""].join(""))); + ""].join("")); return container; }, @@ -1667,11 +1667,11 @@ the specific language governing permissions and limitations under the Apache Lic // install default initSelection when applied to hidden input and data is local opts.initSelection = opts.initSelection || function (element, callback) { var id = element.val(); - //search in data by id + //search in data by id opts.query({ matcher: function(term, text, el){ return equal(id, opts.id(el)); - }, + }, callback: !$.isFunction(callback) ? $.noop : function(filtered) { callback(filtered.results.length ? filtered.results[0] : null); } @@ -1830,7 +1830,7 @@ the specific language governing permissions and limitations under the Apache Lic // multi createContainer: function () { - var container = $(document.createElement("div").attr({ + var container = $(document.createElement("div")).attr({ "class": "select2-container select2-container-multi" }).html([ "