前端面试总结08-WebApi-Dom

1.Dom的本质:

树结构(Dom树)

 

 

 2.Dom常见获取结点操作

(1:document.getElementById('');

(2:document.getElementsByTagName('');//集合

(3:document.getElementsByClassName('');//集合

(4:document.querySelectorAll('')

3.property与attribute

 

 

 

 

 

 property:修改对象属性,不会体现到html结构中

attribute:修改html属性,会改变html结构

两者都有可能引起Dom重新渲染

4.插入节点

 

 

 5.获取子元素,父元素

 

 

 6.删除节点

 

 

 7.Dom性能

(1:Dom操作非常"昂贵",避免频繁的Dom操作

(2:对Dom查询做缓存

 

 

 

(3:将频繁操作改为一次性操作

 

posted @ 2022-09-27 17:28  qwq萌新  阅读(10)  评论(0)    收藏  举报