Fork me on GitHub

different

mouseover与mouseenter

mouseover 支持冒泡事件,鼠标移入到子元素也触发mouseover事件。
mouseenter 不支持冒泡事件,鼠标移入到子元素不触发mouseenter事件。

b与strong,i与em

strong表示强调,有语气加强的含义,使用阅读设备阅读时会重度
b则是展示强调内容

i为斜体,em表示强调的文本。

target,currentTarget

e.target 指向触发事件监听的对象。
e.currentTarget 指向添加监听事件的对象。

ul.addEventListener('click',function(e){
   let oLi1 = e.target  
   let oLi2 = e.currentTarget
    console.log(oLi1)   //  被点击的li
    console.log(oLi2)   // ul
    console.og(oLi1===oLi2)  // false
})

在jQuery提供的on方法中,e.currentTarget与该方法接收的第二个参数有关

$(this.play_el).on('click', 'li', self.changePlayNav.bind(self));
changePlayNav(e){
    let self = this;
    let $cur = $(e.currentTarget); // li
    console.log($(e.target));
    console.log($cur,333);
}

toLowerCase() toLocaleLowerCase()

后者针对 地区,用后者更严谨一些

link与@import 区别

1. link是html标签,@import是css提供的
2. link在浏览器加载同时加载,@import 在浏览器加载完成后加载
3. link无兼容性问题,@import要css2.1以上才兼容
4. link权重大于@import

ajax中 GET与POST区别

1. get 参数提交到url中,而post不会提交到url中。
2. get请求发送的数据小 1kb,而post发送的数据大2M。
3. get请求需要注意缓存的问题,post不用担心。
4. get请求数据会被浏览器缓存起来,(有安全问题),POST可以避免。

split与join区别

split 将字符串分割成数组
join  将数组组合成字符串

cookies,sessionStorage和localStorage 区别

1. cookies内存小4kb,localStorage内存大5M.
2. cookies有时间限制,localStorage长期存储,sessionStorage关闭窗口清除
3. cookies的api 封装困难。localStorage的api封装简单。

块级元素与行内元素的区别

行内元素:不单独成一行,不能设置宽高,padding/margin不能设置top/bottom
块级元素:单独成一行,可以设置宽高,padding/margin都可用。
-------------本文结束感谢您的阅读-------------