prefer textContent over innerText as it's faster
and transforms the text less
This commit is contained in:
parent
317e88bef2
commit
bb73521f0c
1 changed files with 6 additions and 4 deletions
|
@ -37,14 +37,16 @@ function parseHtmlMessage(html) {
|
||||||
const resourceId = pillMatch[1]; // The room/user ID
|
const resourceId = pillMatch[1]; // The room/user ID
|
||||||
const prefix = pillMatch[2]; // The first character of prefix
|
const prefix = pillMatch[2]; // The first character of prefix
|
||||||
switch (prefix) {
|
switch (prefix) {
|
||||||
case "@": return new UserPillPart(resourceId);
|
case "@": return new UserPillPart(resourceId, n.textContent);
|
||||||
case "#": return new RoomPillPart(resourceId);
|
case "#": return new RoomPillPart(resourceId, n.textContent);
|
||||||
default: return new PlainPart(n.innerText);
|
default: return new PlainPart(n.textContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return new PlainPart(n.innerText);
|
return new PlainPart(n.textContent);
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}).filter(p => !!p);
|
}).filter(p => !!p);
|
||||||
return parts;
|
return parts;
|
||||||
|
|
Loading…
Reference in a new issue