Ver Fonte

Merge pull request #64 from ghing/patch-1

Check for nonexistent data attribute in a way that works in jQuery 1.4.2
Igor Vaynberg há 13 anos atrás
pai
commit
97125fb938
1 ficheiros alterados com 2 adições e 1 exclusões
  1. 2 1
      select2.js

+ 2 - 1
select2.js

@@ -352,7 +352,8 @@
             this.id=opts.id;
             this.id=opts.id;
 
 
             // destroy if called on an existing component
             // destroy if called on an existing component
-            if (opts.element.data("select2") !== undefined) {
+            if (opts.element.data("select2") !== undefined &&
+                opts.element.data("select2") !== null) {
                 this.destroy();
                 this.destroy();
             }
             }