1,IE6/7/8中typeof运算符对BOM对象如window,document,location,history等对象的方法错误的返回“object”,标准浏览器都返回“function”。
alert(typeof window.alert); alert(typeof document.write); alert(typeof document.getElementById); alert(typeof document.getElementsByTagName); alert(typeof location.reload); alert(typeof history.go);
2,Safari/Chrome对正则对象错误的返回function,其它浏览器返回object
var bb = new RegExp('bb'); alert(typeof /aa/);// --> function alert(typeof bb);// --> function
3,Safari对NodeList返回function,其它浏览器返回object
var nodes1 = document.body.children nodes2 = document.body.childNodes; alert(typeof nodes1); alert(typeof nodes2);