You don't have to add the element to the DOM, even in FireFox. Replace the .click() method with the following code:
link.dispatchEvent(new MouseEvent(`click`, {bubbles: true, cancelable: true, view: window}));
$('button').on('click', function(event) {
var link = document.createElement('a');
link.download = 'test.xls';
link.href = 'data:application/vnd.ms-excel;utf-8,test';
link.dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true, view: window}));
});