refactor: fix memory leak in auth-modal, consolidate escapeHTML helper across 11 components
This commit is contained in:
@@ -3,6 +3,7 @@ import { listingsService } from '../../services/listings.js'
|
||||
import { directus } from '../../services/directus.js'
|
||||
import { locationsService } from '../../services/locations.js'
|
||||
import { auth } from '../../services/auth.js'
|
||||
import { escapeHTML } from '../../utils/helpers.js'
|
||||
import '../listing-card.js'
|
||||
import '../skeleton-card.js'
|
||||
import '../search-box.js'
|
||||
@@ -461,10 +462,10 @@ class PageHome extends HTMLElement {
|
||||
return /* html */`
|
||||
<listing-card
|
||||
listing-id="${listing.id}"
|
||||
title="${this.escapeHtml(listing.title || '')}"
|
||||
title="${escapeHTML(listing.title || '')}"
|
||||
price="${listing.price || ''}"
|
||||
currency="${listing.currency || 'EUR'}"
|
||||
location="${this.escapeHtml(locationName)}"
|
||||
location="${escapeHTML(locationName)}"
|
||||
image="${imageUrl}"
|
||||
owner-id="${listing.user_created || ''}"
|
||||
></listing-card>
|
||||
@@ -486,12 +487,6 @@ class PageHome extends HTMLElement {
|
||||
|
||||
return listingsHtml + loadMoreHtml
|
||||
}
|
||||
|
||||
escapeHtml(text) {
|
||||
const div = document.createElement('div')
|
||||
div.textContent = text
|
||||
return div.innerHTML
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('page-home', PageHome)
|
||||
|
||||
Reference in New Issue
Block a user