chromium/third_party/blink/renderer/core/testing/data/domfocusout_domfocusin_events.html

<input id="field" />
<div id="message"></div>
<script>
  var field = document.getElementById('field');

  field.addEventListener('DOMFocusOut', function() {
    document.getElementById('message').innerText += 'DOMFocusOut';

    field.addEventListener('DOMFocusIn', function() {
      document.getElementById('message').innerText += 'DOMFocusIn';
    });
  });

  field.focus();
</script>