forked from retoor/snek
fix: append full message element instead of its first child in chat
The change replaces `message.firstChild` with `message` when appending to `.chat-messages`, ensuring the complete message wrapper (including outer div with data attributes) is added to the DOM rather than just its inner content. This preserves the element's dataset properties for subsequent interactions.
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
message.dataset.user_nick = data.user_nick;
|
||||
message.dataset.uid = data.uid;
|
||||
message.innerHTML = data.html;
|
||||
document.querySelector(".chat-messages").appendChild(message.firstChild);
|
||||
document.querySelector(".chat-messages").appendChild(message);
|
||||
updateLayout();
|
||||
setTimeout(()=>{
|
||||
updateLayout()
|
||||
|
||||
Reference in New Issue
Block a user