chz*_*zzh 6 javascript dom observers
似乎当我在 DOMContentLoaded 事件上将节点传递给 ResizeObserver.observe() 时,它会立即调用。这是否被视为正常行为?
是的,这种行为是根据规范(参考):
当被观察的元素从 DOM 中插入/移除时,观察将触发。
当观察元素显示设置为无时,观察将触发。
Observations do not fire for non-replaced inline Elements.
Observations will not be triggered by CSS transforms.
Observation will fire when observation starts if Element is being rendered, and Element’s size is not 0,0.
So in your case, either the element was not yet in the DOM and case 1 will make it fire, either it was already, and case 5 will (though in DOMContentLoaded, that should be 5 ;).
| 归档时间: | 
 | 
| 查看次数: | 614 次 | 
| 最近记录: |