Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<div id="target" style="background: lime; width: 100px; height: 100px;">target</div>
<script>
  console.log("Setting ResizeObserver...");
  var ro = new ResizeObserver( entries => {
    for (let entry of entries) {
      const cr = entry.contentRect;
      console.log(`Size: ${cr.width}px x ${cr.height}px`);
    }
  });
  // make sure 
  document.body.clientHeight;
  ro.observe(target);
  console.log("Changing size of element...");
  target.style = "background: lime; width: 0; height: 0;";
</script>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers