面经 20191129 未完待续...
1. 伪类选择器
first-of-type last-of-type only-of-type only-child
nth-child nth-last-child nth-of-type nth-last-of-type enable disable checked not selection
2. 事件委托,使用事件委托有什么好处?
就是让别人来做,这个事件本来是加在某些元素上的,然而你却加到别人身上来做,完成这个事件。
也就是:利用冒泡的原理,把事件加到父级上,触发执行效果。
好处呢:1,提高性能。
3.怎么阻止事件冒泡?
阻止事件冒泡:ie:window.event.cancelBubble=true;而非ie:e.stopPropagation();
阻止默认事件:ie:window.event.returnValue = false;return false;而非ie:e.preventDefault();
4.跨域的方法:
1> document.domain + iframe (只有在主域相同的时候才能使用该方法)
2> window.name + iframe
3>html5中的postMessage()
4>CORS
5>jsonp
6>websocket
跨域支持post请求的:
1>CORS
2>window.postMessage
3>html5的websocket
4>iframe http://www.jianshu.com/p/4773501f1adf
5>flash proxy
5.Ajax 请求Json数据该如何解析
1)eval()方法: var dataObj=eval("("+data+")");//转换为json对象
2) 使用Json.parse()
3)new Function()