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

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

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

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

  field.focus();
</script>