From 76467073f205ff84cd23191b727f7a4f863dcf22 Mon Sep 17 00:00:00 2001 From: Gasim Gasimzada Date: Sun, 12 Jan 2020 02:25:33 +0400 Subject: [PATCH] Use `innerText` instead of `innerHTML` when measuring text (#312) --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index dcec4881..4043c5a4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -34,7 +34,7 @@ export function measureText(text: string, font: string) { line.style.font = font; body.appendChild(line); // Now we can measure width and height of the letter - line.innerHTML = text; + line.innerText = text; const width = line.offsetWidth; const height = line.offsetHeight; // Now creating 1px sized item that will be aligned to baseline