diff --git a/examples/treeTable.html b/examples/treeTable.html index 3cbdcd52..f2408f03 100644 --- a/examples/treeTable.html +++ b/examples/treeTable.html @@ -26,6 +26,53 @@ <script src="../src/layui.js"></script> <script> +// IE8 support +// ES5 15.4.4.19 Array.prototype.map ( callbackfn [ , thisArg ] ) +// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/Map +if (!Array.prototype.map) { + Array.prototype.map = function (fun /*, thisp */) { + if (this === void 0 || this === null) { throw TypeError(); } + + var t = Object(this); + var len = t.length >>> 0; + if (typeof fun !== "function") { throw TypeError(); } + + var res = []; res.length = len; + var thisp = arguments[1], i; + for (i = 0; i < len; i++) { + if (i in t) { + res[i] = fun.call(thisp, t[i], i, t); + } + } + + return res; + }; +} + +// ES5 15.4.4.20 Array.prototype.filter ( callbackfn [ , thisArg ] ) +// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/Filter +if (!Array.prototype.filter) { + Array.prototype.filter = function (fun /*, thisp */) { + if (this === void 0 || this === null) { throw TypeError(); } + + var t = Object(this); + var len = t.length >>> 0; + if (typeof fun !== "function") { throw TypeError(); } + + var res = []; + var thisp = arguments[1], i; + for (i = 0; i < len; i++) { + if (i in t) { + var val = t[i]; // in case fun mutates this + if (fun.call(thisp, val, i, t)) { + res.push(val); + } + } + } + + return res; + }; +} layui.use(['treeTable', 'dropdown', 'layer'], function(){ var treeTable = layui.treeTable; var dropdown = layui.dropdown; diff --git a/src/modules/element.js b/src/modules/element.js index f7863405..d6e15500 100644 --- a/src/modules/element.js +++ b/src/modules/element.js @@ -519,8 +519,8 @@ layui.define('jquery', function(exports){ var itemElem = othis.find('.'+NAV_ITEM); // hover 滑动效果 - var hasBarElem = othis.find('.'+NAV_BAR)[0]; - if (hasBarElem) hasBarElem.remove(); + var hasBarElem = othis.find('.'+NAV_BAR); + if (hasBarElem[0]) hasBarElem.remove(); othis.append(bar); ( othis.hasClass(NAV_TREE) ? itemElem.find('dd,>.'+ NAV_TITLE)