JSFiddle - React, Tailwind, and code Playground

by pimvdb

JavaScript

var result = (function() {
    var hasIt = false;
    
    function swap() {
        hasIt = true;
    }
    
    var a = document.createElement('a');
    a.href = "#";
    a.addEventListener('focusin', swap, false);
    
    document.body.appendChild(a);
    a.focus();
    document.body.removeChild(a);
    
    return hasIt;
})();

alert(result);