refactor: fix memory leak in auth-modal, consolidate escapeHTML helper across 11 components

This commit is contained in:
2026-02-05 15:07:18 +01:00
parent cd437f20e1
commit 08a650ea80
13 changed files with 44 additions and 131 deletions

View File

@@ -1,4 +1,5 @@
import { t, i18n } from '../i18n.js'
import { escapeHTML } from '../utils/helpers.js'
const CATEGORIES = {
electronics: ['phones', 'computers', 'tv_audio', 'gaming', 'appliances'],
@@ -171,7 +172,7 @@ class SearchBox extends HTMLElement {
if (this.searchQuery) {
badges.push(/* html */`
<button type="button" class="filter-badge" data-filter="query">
<span class="filter-badge-text">"${this.escapeHtml(this.searchQuery)}"</span>
<span class="filter-badge-text">"${escapeHTML(this.searchQuery)}"</span>
<svg class="filter-badge-close" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
@@ -230,12 +231,6 @@ class SearchBox extends HTMLElement {
`
}
escapeHtml(text) {
const div = document.createElement('div')
div.textContent = text
return div.innerHTML
}
renderFilters() {
// Track which category accordion is expanded
this._expandedCategory = this._expandedCategory || ''