Browse Source

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 years ago
parent
commit
7b3816daff
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/bootstrap-table.js

+ 7 - 1
src/bootstrap-table.js

@@ -10,7 +10,13 @@
 
 
   let bootstrapVersion = 3
   let bootstrapVersion = 3
   try {
   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) {}
   } catch (e) {}
 
 
   const bootstrap = {
   const bootstrap = {