diff options
| author | Osmium Sorcerer <os@sof.beauty> | 2026-06-03 11:08:07 +0000 |
|---|---|---|
| committer | Osmium Sorcerer <os@sof.beauty> | 2026-06-06 03:09:27 +0000 |
| commit | bd8b53cd6046cef9802d593d8257392d81afb5ce (patch) | |
| tree | de52981395cb330f65232f0edbd48dbd4fdf9739 /webAO/client/saveChatLogHandle.ts | |
| parent | da790cb4fa1cc221a0b557d2cf64585b8e4ebcf9 (diff) | |
Eliminate innerHTML manipulation
Construct DOM nodes directly instead of trying to sanitize every input
string and dynamically updating HTML.
Replace all uses of innerHTML with textContent, replaceChildren, and
appendChild.
This removes the need to use safeTags and replace newlines, but now
requires preserving whitespace via CSS pre-wrap.
Every OOC chat line is now placed into its own element instead of simply
being appended to the log. This might be worse, and createTextNode
is another alternative.
Diffstat (limited to 'webAO/client/saveChatLogHandle.ts')
| -rw-r--r-- | webAO/client/saveChatLogHandle.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/webAO/client/saveChatLogHandle.ts b/webAO/client/saveChatLogHandle.ts index 5e6b277b..b184e09d 100644 --- a/webAO/client/saveChatLogHandle.ts +++ b/webAO/client/saveChatLogHandle.ts @@ -8,8 +8,8 @@ export const saveChatlogHandle = async () => { for (let i = 0; i < icMessageLogs.length; i++) { const SHOWNAME_POSITION = 0; const TEXT_POSITION = 2; - const showname = icMessageLogs[i].children[SHOWNAME_POSITION].innerHTML; - const text = icMessageLogs[i].children[TEXT_POSITION].innerHTML; + const showname = icMessageLogs[i].children[SHOWNAME_POSITION].textContent; + const text = icMessageLogs[i].children[TEXT_POSITION].textContent; const message = `${showname}: ${text}`; messages.push(message); } |
