Explorar o código

Use `innerText` instead of `innerHTML` when measuring text (#312)

Gasim Gasimzada %!s(int64=5) %!d(string=hai) anos
pai
achega
76467073f2
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/utils.ts

+ 1 - 1
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