mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-19 21:10:53 +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
-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