mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-10-15 02:28:16 +02:00
refactor: Improve toast notification rendering and event handling
- Refactored the ShowToastJS function to create toast elements using DOM methods for better safety and maintainability. - Changed the event listener for the 'showToast' event from document.body to document for improved event handling. - Ensured that the message content is set using textContent to prevent potential XSS vulnerabilities.
This commit is contained in:
1 parent
0f46b20fc4
commit
16e7b7e6e5
2 files changed
+31
-18
No files matched your search
+1
-1
@@ -449,7 +449,7 @@ function enhanceMobileForms() {
|
||||
|
||||
|
||||
// Listen for custom 'showToast' event triggered by HX-Trigger
|
||||
document.body.addEventListener('showToast', function(event) {
|
||||
document.addEventListener('showToast', function(event) { // Changed from document.body
|
||||
// Debug logs removed
|
||||
if (event.detail && event.detail.message && event.detail.type) {
|
||||
// Call the globally defined showToast function from toast_js.templ
|
||||
|
||||
Reference in new issue
Block a user