Security: use safe 'setAttribute'

This commit is contained in:
Pieter Vander Vennet 2023-09-21 02:35:29 +02:00
parent 8d1ae657fc
commit ac236199fc

View file

@ -53,17 +53,17 @@ export default class Link extends BaseUIElement {
}
const el = document.createElement("a")
if (typeof this._href === "string") {
el.href = this._href
el.setAttribute("href", this._href)
} else {
this._href.addCallbackAndRun((href) => {
el.href = href
el.setAttribute("href", href)
})
}
if (this._newTab) {
el.target = "_blank"
}
if (this._download) {
el.download = this._download
el.setAttribute("download", this._download)
}
el.appendChild(embeddedShow)
return el