From a24bd3897a5f93f1438b1680cdcbe0c829b39493 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Fri, 10 Sep 2021 19:23:18 +0200 Subject: [PATCH] (perf) deduplicate getComputedStyle call --- 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 fc42ee2dcf5b..8f5a9521b6f0 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) {