From bb73521f0c8fb5999c421218cf90dfb7124845bf Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 9 May 2019 15:01:17 +0200 Subject: [PATCH] prefer textContent over innerText as it's faster and transforms the text less --- src/editor/parse-event.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/editor/parse-event.js b/src/editor/parse-event.js index b4dc22ee4e..51b96a58e7 100644 --- a/src/editor/parse-event.js +++ b/src/editor/parse-event.js @@ -37,14 +37,16 @@ function parseHtmlMessage(html) { const resourceId = pillMatch[1]; // The room/user ID const prefix = pillMatch[2]; // The first character of prefix switch (prefix) { - case "@": return new UserPillPart(resourceId); - case "#": return new RoomPillPart(resourceId); - default: return new PlainPart(n.innerText); + case "@": return new UserPillPart(resourceId, n.textContent); + case "#": return new RoomPillPart(resourceId, n.textContent); + default: return new PlainPart(n.textContent); } } default: - return new PlainPart(n.innerText); + return new PlainPart(n.textContent); } + default: + return null; } }).filter(p => !!p); return parts;