Преглед на файлове

Avoid error when label has no matching element

$('#no_such_element').data("select2") returns null rather than
undefined (jQuery 1.9.0).
Ronald J Kimball преди 12 години
родител
ревизия
7ec1e753dc
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      select2.js

+ 1 - 1
select2.js

@@ -529,7 +529,7 @@ the specific language governing permissions and limitations under the Apache Lic
                 attr = attr.replace(/([\[\].])/g,'\\$1'); /* escapes [, ], and . so properly selects the id */
                 target = $("#"+attr);
                 target = target.data("select2");
-                if (target !== undefined) { target.focus(); e.preventDefault();}
+                if (target !== undefined && target !== null) { target.focus(); e.preventDefault();}
             }
         });
     });