I am trying to detect a focus out event after focusin was set programatically. Take a look at the example: (click on blue element sets focusin, clicking on document should trigger focusout)
https://jsfiddle.net/k946vcza/1/
For some reason, if focusin is set with
  var focusin = new Event("focusin");
  red.dispatchEvent(focusin);
focusout does not get triggered  when clicked on the document. If you first click on the red element and then on document, then focusout is detected as expected.
What am I missing here?
 
    