[PORT] Enable no-jquery/no-parse-html-literal and fix violation (gitea#31684)

Tested it, path segment creation works just like before.

---

Conflict resolution: trivial, also ported code from
https://github.com/go-gitea/gitea/pull/31283
This commit is contained in:
silverwind 2024-07-27 16:44:41 +02:00 committed by Gusted
parent 22de4ae9c4
commit 2cf91d58e7
No known key found for this signature in database
GPG key ID: FD821B732837125F
4 changed files with 44 additions and 13 deletions

View file

@ -296,3 +296,10 @@ export function replaceTextareaSelection(textarea, text) {
textarea.dispatchEvent(new CustomEvent('change', {bubbles: true, cancelable: true}));
}
}
// Warning: Do not enter any unsanitized variables here
export function createElementFromHTML(htmlString) {
const div = document.createElement('div');
div.innerHTML = htmlString.trim();
return div.firstChild;
}