From c040f130b761a6aae64590999516adec5bb89680 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Fri, 10 Sep 2021 19:33:46 +0200 Subject: [PATCH] [fix] (perf) deduplicate getComputedStyle call (#6721) --- src/runtime/transition/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts index fc42ee2dcf..8f5a9521b6 100644 --- a/src/runtime/transition/index.ts +++ b/src/runtime/transition/index.ts @@ -179,8 +179,9 @@ export function draw(node: SVGElement & { getTotalLength(): number }, { easing = cubicInOut }: DrawParams = {}): TransitionConfig { let len = node.getTotalLength(); - if (getComputedStyle(node).strokeLinecap !== 'butt') { - len += parseInt(getComputedStyle(node).strokeWidth); + const style = getComputedStyle(node); + if (style.strokeLinecap !== 'butt') { + len += parseInt(style.strokeWidth); } if (duration === undefined) {