console
const witchEvent = (function () {
if (window.addEventListener) {
return function (element, type, callback, useCapture) {
element.addEventListener(type, function (e) {
callback.call(element, e)
}, useCapture)
}
} else if (window.attachEvent) {
return function (element, type, callback) {
element.attachEvent('on' + type, function (e) {
callback.call(element, e)
})
}
}
})()
witchEvent()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=">
<meta http-equiv="X-UA-Compatible" content="">
<title>函数柯理化</title>
</head>
<body>
</body>
</html>