Skip to content

Commit

Permalink
[fix] (perf) deduplicate getComputedStyle call (sveltejs#6721)
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Sep 10, 2021
1 parent e34195d commit c040f13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/transition/index.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit c040f13

Please sign in to comment.