浏览代码

Fix #1359 Cookie extension not working with default settings

Dennis Hernández 10 年之前
父节点
当前提交
a512b86923
共有 1 个文件被更改,包括 15 次插入2 次删除
  1. 15 2
      src/extensions/cookie/bootstrap-table-cookie.js

+ 15 - 2
src/extensions/cookie/bootstrap-table-cookie.js

@@ -41,12 +41,25 @@
         return !!(navigator.cookieEnabled);
         return !!(navigator.cookieEnabled);
     };
     };
 
 
+    var inArrayCookiesEnabled = function (cookieName, cookiesEnabled) {
+        var index = -1;
+
+        for (var i = 0; i < cookiesEnabled.length; i++) {
+            if (cookieName.toLowerCase() === cookiesEnabled[i].toLowerCase()) {
+                index = i;
+                break;
+            }
+        }
+
+        return index;
+    };
+
     var setCookie = function (that, cookieName, cookieValue) {
     var setCookie = function (that, cookieName, cookieValue) {
         if ((!that.options.cookie) || (!cookieEnabled()) || (that.options.cookieIdTable === '')) {
         if ((!that.options.cookie) || (!cookieEnabled()) || (that.options.cookieIdTable === '')) {
             return;
             return;
         }
         }
 
 
-        if ($.inArray(cookieName.toLowerCase(), that.options.cookiesEnabled) === -1) {
+        if (inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
             return;
             return;
         }
         }
 
 
@@ -64,7 +77,7 @@
             return null;
             return null;
         }
         }
 
 
-        if ($.inArray(cookieName.toLowerCase(), that.options.cookiesEnabled) === -1) {
+        if (inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
             return null;
             return null;
         }
         }