mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/17326] Ignore invalid class names
PHPBB-17326
This commit is contained in:
parent
68c4e22886
commit
67e2b32816
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue