-
Notifications
You must be signed in to change notification settings - Fork 6
about Brower
CodeDreamfy edited this page May 30, 2016
·
3 revisions
- 谈谈HTTP协议中的短轮询、长轮询、长连接和短连接
- Web缓存知识
- Comet:基于 HTTP 长连接的“服务器推”技术
- JavaScript跨域总结与解决办法
- 浏览器重绘与重排
- 使用 attachEvent() 注册的处理程序作为函数调用,它们的 this 值是全局 Window 对象
- 通常调用事件处理程序时把事件对象作为它们的一个参数。在 IE8 及以前版本中,通过设置属性注册事件处理程序,当调用它们时并未传递事件对象,取而代之,需要通过全局对象 window.event 来获得事件对象。
- attachEvent() 允许相同的事件处理程序函数注册多次,当特定的事件类型发生时,注册函数的调用次数和注册次数一样
- focus 、 blur 、 scroll 不会冒泡;文档元素上的 load 事件会冒泡,但会在 Document 对象上停止冒泡而不会传播到 Window 对象。只有当整个文档都加在完毕时才会触发 Window 的 load 事件
- 当文档准备就绪时调用函数:
/**
* DOMContentLoaded 、 readystatechange 、 或 load 事件发生的时候会触发回调
*/
var whenReady = (function() {
var funcs = [];
var ready = false;
function handler(e) {
if (ready) return;
if (e.type === 'readystatechange' && document.readystate !== 'complete') {
return;
}
for (var i = 0, il = funcs.length; i < il; i++) {
funcs[i].call(document);
}
ready = true;
funcs = null;
}
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', handler, false);
document.addEventListener('readystatechange', handler, false);
window.addEventListener('load', handler, false);
} else if (document.attachEvent) {
document.attachEvent('onreadystatechange', handler);
window.attachEvent('onload', handler);
}
return function whenReady(f) {
if (ready) f.call(document);
else funcs.push(f);
}
})();- stopImmediatePropagation()
- chrome 清除 DNS cache : chrome://net-internals/#dns