Skip to content

Commit 31dee50

Browse files
committed
fix: move check for inlinable expression as last
1 parent 3928ce9 commit 31dee50

File tree

1 file changed

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

1 file changed

+8
-11
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export function process_children(nodes, initial, is_element, { visit, state }) {
130130
function is_static_element(node, state) {
131131
if (node.type !== 'RegularElement') return false;
132132
if (node.fragment.metadata.dynamic) return false;
133+
if (node.name.includes('-')) return false; // we're setting all attributes on custom elements through properties
133134

134135
for (const attribute of node.attributes) {
135136
if (attribute.type !== 'Attribute') {
@@ -140,15 +141,6 @@ function is_static_element(node, state) {
140141
return false;
141142
}
142143

143-
if (attribute.value !== true && !is_text_attribute(attribute)) {
144-
// if it's not a text attribute but it's an inlinable expression
145-
// we will inline it in the template so we can still consider it static
146-
return is_inlinable_expression(
147-
Array.isArray(attribute.value) ? attribute.value : [attribute.value],
148-
state
149-
);
150-
}
151-
152144
if (attribute.name === 'autofocus' || attribute.name === 'muted') {
153145
return false;
154146
}
@@ -162,8 +154,13 @@ function is_static_element(node, state) {
162154
return false;
163155
}
164156

165-
if (node.name.includes('-')) {
166-
return false; // we're setting all attributes on custom elements through properties
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(
161+
Array.isArray(attribute.value) ? attribute.value : [attribute.value],
162+
state
163+
);
167164
}
168165
}
169166

0 commit comments

Comments
 (0)