Chrome Version: (copy from chrome://version)
OS: (e.g. Win7, OSX 10.9.5, etc...)
From https://github.com/WICG/ResizeObserver/issues/38#issuecomment-290282872
I thought I'd post here first, in case this is intended behavior and not a Chrome bug. Couldn't quite tell from the spec.
Take a look at the following code ([live here](http://jsbin.com/copiyel/6/edit?js,console,output)):
```js
var div = document.querySelector("div");
var resizeObserver = new ResizeObserver(entries => {
console.log("resizeobserver fired");
resizeObserver.disconnect();
// [Operation that would cause resize here]
resizeObserver.observe(div);
});
resizeObserver.observe(div);
```
This is a very common pattern with any kind of observer: Often you want to monitor external changes to the DOM and as a response to them, you need to make changes of your own that should not trigger the same observer because that would cause a loop.
With Mutation observers, this pattern works fine. However, since `ResizeObserver` seems to be firing the callback immediately after `observe()` is called, this causes an infinite loop.
Comment 1 by leave...@gmail.com
, Mar 30 2017