[ticket/17326] Ignore invalid class names

PHPBB-17326
This commit is contained in:
Marc Alexander 2025-02-15 20:21:25 +01:00
parent 68c4e22886
commit 67e2b32816
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -280,6 +280,12 @@ function parse_document(container)
// Live update BBCode font icon preview // Live update BBCode font icon preview
const updateIconClass = (element, newClass) => { const updateIconClass = (element, newClass) => {
// Ignore invalid class names
const faIconRegex = /^(?!-)(?!.*--)[a-z0-9-]+(?<!-)$/;
if (!faIconRegex.test(newClass)) {
return;
}
element.classList.forEach(className => { element.classList.forEach(className => {
if (className.startsWith('fa-') && className !== 'fa-fw') { if (className.startsWith('fa-') && className !== 'fa-fw') {
element.classList.remove(className); element.classList.remove(className);