Skip to content

Commit 3a45986

Browse files
committed
fix: simplify and correct
1 parent 31dee50 commit 3a45986

File tree

1 file changed

+11
-5
lines changed
  • packages/svelte/src/compiler/phases/3-transform/client/visitors/shared

1 file changed

+11
-5
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,19 @@ function is_static_element(node, state) {
154154
return false;
155155
}
156156

157-
if (attribute.value !== true && !is_text_attribute(attribute)) {
158-
// if it's not a text attribute but it's an inlinable expression
159-
// we will inline it in the template so we can still consider it static
160-
return is_inlinable_expression(
157+
if (
158+
attribute.value !== true &&
159+
!is_text_attribute(attribute) &&
160+
// if the attribute is not a text attribute but is inlinable we will directly inline it in the
161+
// the template so if it's not inlinable we can return false but if it is inlinable (or a text)
162+
// attribute we keep count of the inlinable attributes so that if all the attributes are inlinable
163+
// we deem the node as static
164+
!is_inlinable_expression(
161165
Array.isArray(attribute.value) ? attribute.value : [attribute.value],
162166
state
163-
);
167+
)
168+
) {
169+
return false;
164170
}
165171
}
166172

0 commit comments

Comments
 (0)