forked from Skalman/UglifyJS-online
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I found out, that there are code snippets that just don't work minified. I am unable to find the exact reason why.
The code just does not work
Here is one example
function applyTableStyles() {
const tables = document.querySelectorAll('table');
tables.forEach(table => {
table.addEventListener('click', (event) => {
event.stopPropagation();
console.log('Table clicked');
alert('Table clicked!');
exportToExcel(table);
}, true);
});
}
function exportToExcel(table) {
let tableData = table.outerHTML; // Capture the table HTML
tableData = tableData.replace(/<input[^>]*>|<\/input>/gi, ""); // Remove input elements if any
let a = document.createElement('a');
a.href = 'data:application/vnd.ms-excel;charset=utf-8,' + encodeURIComponent(tableData);
a.download = `table_${get_suffix()}.xls`;
a.click();
}
function get_suffix() {
let dateObj = new Date();
let dateTime = `${dateObj.getHours()}${dateObj.getMinutes()}${dateObj.getSeconds()}`;
return `${dateTime}${Math.floor(Math.random() * 100)}`;
}
document.addEventListener('DOMContentLoaded', () => {
applyTableStyles();
const observer = new MutationObserver(applyTableStyles);
observer.observe(document.body, { childList: true, subtree: true });
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels