Skip to content

Commit c040f13

Browse files
authored
[fix] (perf) deduplicate getComputedStyle call (#6721)
1 parent e34195d commit c040f13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/runtime/transition/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ export function draw(node: SVGElement & { getTotalLength(): number }, {
179179
easing = cubicInOut
180180
}: DrawParams = {}): TransitionConfig {
181181
let len = node.getTotalLength();
182-
if (getComputedStyle(node).strokeLinecap !== 'butt') {
183-
len += parseInt(getComputedStyle(node).strokeWidth);
182+
const style = getComputedStyle(node);
183+
if (style.strokeLinecap !== 'butt') {
184+
len += parseInt(style.strokeWidth);
184185
}
185186

186187
if (duration === undefined) {

0 commit comments

Comments
 (0)