浏览代码

Fixed a bug preventing older versions of Bootstrap from working (introduced by 46e6774) (#3782)

* Fixed a bug preventing older versions of Bootstrap from working (introduced by 46e6774)

* Minor code style changes

* Minor code style changes
Mark McEver 7 年之前
父节点
当前提交
7b3816daff
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/bootstrap-table.js

+ 7 - 1
src/bootstrap-table.js

@@ -10,7 +10,13 @@
 
   let bootstrapVersion = 3
   try {
-    bootstrapVersion = parseInt($.fn.dropdown.Constructor.VERSION, 10)
+    var rawVersion = $.fn.dropdown.Constructor.VERSION
+
+    // Only try to parse VERSION if is is defined.
+    // It is undefined in older versions of Bootstrap (tested with 3.1.1).
+    if (rawVersion !== undefined) {
+      bootstrapVersion = parseInt(rawVersion, 10)
+    }
   } catch (e) {}
 
   const bootstrap = {