瀏覽代碼

copy the args object so changes to it no longer effect other select2s. closes #47

Igor Vaynberg 13 年之前
父節點
當前提交
e0f854d667
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      select2.js

+ 1 - 1
select2.js

@@ -1417,7 +1417,7 @@
 
         this.each(function () {
             if (args.length === 0 || typeof(args[0]) === "object") {
-                opts = args.length === 0 ? {} : args[0];
+                opts = args.length === 0 ? {} : $.extend({}, args[0]);
                 opts.element = $(this);
 
                 if (opts.element.get(0).tagName.toLowerCase() === "select") {