<!DOCTYPE html>
<html>
  <head>
    <script src="util.js"></script>
    <script>
window.onload = function() {
  document.head.appendChild(build_rule("caption#foo", 1, "{ color: blue; } "));
  let dom = build_dom(2048, "div");
  let p = dom;
  for (var i = 0; i < 5; ++i ) {
    p = p.firstChild.lastChild;
  }
  let elem = document.createElement("caption");
  p.appendChild(elem);
  document.body.appendChild(dom);
  flush_layout();

  perf_start();
  var state = true;
  for (i = 0; i < 100000; ++i) {
    elem.setAttribute("id", state ? "" : "foo");
    state = !state;
    flush_style(elem);
  }
  perf_finish();
};
    </script>
  </head>
  <body>
  </body>
</html>
