Browse Source
Merge in VISUAL/fineui from ~DAILER/fineui:es6 to es6 * commit 'a867349e9811230b7f6c5cf94ef1fa09504cf242': 无JIRA 抽象类就不用shortcut了 无JIRA 整理一下es6
Dailer-刘荣歆
2 years ago
6 changed files with 10 additions and 241 deletions
@ -1,15 +0,0 @@ |
|||||||
const isIE = () => typeof window.CustomEvent !== "function"; |
|
||||||
|
|
||||||
if (isIE()) { |
|
||||||
function CustomEvent(event, params) { |
|
||||||
params = params || { bubbles: false, cancelable: false, detail: undefined }; |
|
||||||
const evt = document.createEvent("CustomEvent"); |
|
||||||
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); |
|
||||||
|
|
||||||
return evt; |
|
||||||
} |
|
||||||
|
|
||||||
CustomEvent.prototype = window.Event.prototype; |
|
||||||
|
|
||||||
window.CustomEvent = CustomEvent; |
|
||||||
} |
|
@ -1,3 +1 @@ |
|||||||
export * from "./event"; |
|
||||||
export * from "./number"; |
export * from "./number"; |
||||||
export * from "./sort"; |
|
@ -1,34 +0,0 @@ |
|||||||
// 修复ie9下sort方法的bug
|
|
||||||
// IE的sort 需要显示声明返回-1, 0, 1三种比较结果才可正常工作,而Chrome, Firefox中可以直接返回true, false等
|
|
||||||
// BI-36544 sort提供的参数就可以自定义返回值,不需要特别控制。这边使用冒泡相较于快排可能慢了点。
|
|
||||||
// 这边先将webkit的限制去掉
|
|
||||||
!function (window) { |
|
||||||
var ua = window.navigator.userAgent.toLowerCase(), |
|
||||||
reg = /msie/; |
|
||||||
if (reg.test(ua)) { |
|
||||||
var _sort = Array.prototype.sort; |
|
||||||
Array.prototype.sort = function (fn) { |
|
||||||
if (!!fn && typeof fn === "function") { |
|
||||||
if (this.length < 2) { |
|
||||||
return this; |
|
||||||
} |
|
||||||
var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0; |
|
||||||
for (; i < l; i++) { |
|
||||||
for (j = i + 1; j < l; j++) { |
|
||||||
t = fn.call(this, this[i], this[j]); |
|
||||||
r = (typeof t === "number" ? t : |
|
||||||
t ? 1 : 0) > 0; |
|
||||||
if (r === true) { |
|
||||||
tmp = this[i]; |
|
||||||
this[i] = this[j]; |
|
||||||
this[j] = tmp; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return this; |
|
||||||
} |
|
||||||
return _sort.call(this); |
|
||||||
|
|
||||||
}; |
|
||||||
} |
|
||||||
}(window); |
|
Loading…
Reference in new issue