I'm trying to detect a DOM element screen position change without polling or using events like onscroll
and so on. MutationObserver
would do the trick, but it seems that it won't work for methods (like getBoundingClientRect() for example).
Is that accurate? If not, how do I use MutationObserver to detect clientRect changes?
Example: https://codepen.io/Darksoulsong/pen/rwOQLo
Add new boxes, scroll the viewport, add some more and note that the rect values don't get updated.