 #A { background: blue; }
  #B { background: green; }
</style>

<script>
promise_test(async (t) => {
  t.add_cleanup(async () => {
    while (document.fullscreenElement)
      await document.exitFullscreen();
  });
  document.onfullscreenerror = () => assert_unreached('fullscreenerror should not happen');
  const A = document.getElementById('A');
  const B = document.getElementById('B');
  assert_true(!isTopLayer(A) && !isTopLayer(B));
  await blessTopLayer(document.body);
  await A.requestFullscreen();
  a