javascript学习
- prototype
- closure
- 浏览器内核线程
- event loop
- nodejs event loop
- 事件捕获方式
addEventListener中的第三个参 数是useCapture, 一个bool类型。当为false时为冒泡获取(由里向外),true为capture方式(由外向里)。
<body>
<a id="btnAdd" href="http://news.baidu.com" target="_blank">新增</a>
<script>
function stopEvent(event){
event.preventDefault();
//event.stopPropagation();
};
document.body.addEventListener("click",function(e){console.log("body");stopEvent(e);},false);
var btn = document.getElementById("btnAdd");
btn.addEventListener("click",function(e){console.log("watch1");stopEvent(e);},false);
btn.addEventListener("click",function(e){console.log("watch2");stopEvent(e);},false);
</script>
</body>捕获方式
停止传播useCapture为 true
(由外向里)useCapture为 false
(由里向外)not stopPropagation body,watch1,watch2 watch1,watch2,body stopPropagation body watch1,watch2 - 测试题
1、prototype
2、closure
3、event loop
4、正则