Skip to content

特殊作用的API收集

LYF edited this page Jul 14, 2016 · 31 revisions

1. Element.getBoundingClientRect

Element.getBoundingClientRect()方法返回元素的大小及其相对于视口的位置。

兼容性:无兼容性问题,所有浏览器都支持

https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect

2. Element.getClientRects()

Element.getClientRects() 方法返回一个指向客户端中每一个盒子的边界矩形的矩形集合。

兼容性:无兼容性问题,所有浏览器都支持

https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getClientRects

3. DOMNodeRemoved

在使用removeChild() 或者 replaceChild() 从DOM中删除节点的时候首先会触发 DOMNodeRemoved事件。该事件的 event.target 就是被删除的节点。 而 event.relatedNode则是对目标节点父节点的引用。

http://blog.chinaunix.net/uid-26672038-id-3956106.html

Clone this wiki locally