mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-09 16:05:07 +00:00
fix chat highlights (#92589)
## About The Pull Request If we always define the fragment, the if after the loop will always pass. ## Why It's Good For The Game fixes #92468 <img width="653" height="223" alt="grafik" src="https://github.com/user-attachments/assets/7995b73d-f648-4cbd-b05e-c36f98cab47b" /> ## Changelog 🆑 fix: chat highlights /🆑
This commit is contained in:
@@ -27,9 +27,9 @@ function regexParseNode(params: ReplaceInTextNodeParams): {
|
||||
return { nodes: [], n: 0 };
|
||||
}
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
const nodes: Node[] = [];
|
||||
const textLength = text.length;
|
||||
let fragment: Node | undefined;
|
||||
let count = 0;
|
||||
let lastIndex = 0;
|
||||
let match: RegExpExecArray | null;
|
||||
@@ -44,6 +44,10 @@ function regexParseNode(params: ReplaceInTextNodeParams): {
|
||||
if (++count > 9999) {
|
||||
return { nodes: [], n: 0 };
|
||||
}
|
||||
// Lazy init fragment
|
||||
if (!fragment) {
|
||||
fragment = document.createDocumentFragment();
|
||||
}
|
||||
|
||||
const matchText = captureAdjust ? captureAdjust(match[0]) : match[0];
|
||||
const matchLength = matchText.length;
|
||||
|
||||
Reference in New Issue
Block a user