Skip to content

Instantly share code, notes, and snippets.

@riccardogiorato
Created October 8, 2019 13:08
Show Gist options
  • Save riccardogiorato/cd02f9a073b91e7cdc0f0b09aba65783 to your computer and use it in GitHub Desktop.
Save riccardogiorato/cd02f9a073b91e7cdc0f0b09aba65783 to your computer and use it in GitHub Desktop.
(function(document, window){
var styleText = '::-moz-focus-inner{border:0 !important;}:focus{outline: none !important;';
var unfocus_style = document.createElement('STYLE');
window.unfocus = function(){
document.getElementsByTagName('HEAD')[0].appendChild(unfocus_style);
document.addEventListener('mousedown', function(){
unfocus_style.innerHTML = styleText+'}';
});
document.addEventListener('keydown', function(){
unfocus_style.innerHTML = '';
});
};
unfocus.style = function(style){
styleText += style;
};
unfocus();
})(document, window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment