1.IE低版本没有捕获
2.普通事件绑定写法没有捕获
事件捕获
给父子元素用addEventListener(绑定)同一个事件时,当触发子元素身上的事件,会先触发父元素,然后在传递给子元素,这种传播机制叫事件捕获
attachEvent()和addEventListener()两者区别
1.attachEvent只用在IE8以下,addEventListener()适合标准浏览器
2.attachEvent的事件名带on而addEventListener事件名不带on
3.attachEvent函数里面的this是window,而addEventListener函数里面的this是当前元素对象
attachEvent只有冒泡没有捕获addEventListener有冒泡也有捕获
4.call()和apply()
call和apply,就是改变函数里面的this指向的方法
xxx.call()或者xxx.apply()
特别强调下xxx必须是function(普通函数,类,构造函数)
var obj={
name:"梦泽"
}
function fn(){
console.log(this,name)
}
fn.call(abj)
call()中第一个参数是null的时候,函数里的this还是指向原来的,不变
所有事件都是异步的