(fn, ctx)
| 286 | /* istanbul ignore next */ |
| 287 | //绑定事件 并且改变上下文指向 |
| 288 | function polyfillBind(fn, ctx) { |
| 289 | function boundFn(a) { |
| 290 | var l = arguments.length; |
| 291 | return l |
| 292 | ? l > 1 |
| 293 | ? fn.apply(ctx, arguments) |
| 294 | : fn.call(ctx, a) |
| 295 | : fn.call(ctx) |
| 296 | } |
| 297 | |
| 298 | boundFn._length = fn.length; |
| 299 | return boundFn |
| 300 | } |
| 301 | |
| 302 | //执行方式 |
| 303 | function nativeBind(fn, ctx) { |
nothing calls this directly
no outgoing calls
no test coverage detected