Преглед изворни кода

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();}
             }
         });
     });