Skip to content

Commit f1d77c0

Browse files
committed
chore: unify conditions
1 parent a0b4a21 commit f1d77c0

File tree

1 file changed

+7
-12
lines changed
  • packages/svelte/src/compiler/phases/2-analyze/visitors

1 file changed

+7
-12
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/Attribute.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@ export function Attribute(node, context) {
1818

1919
const parent = /** @type {SvelteNode} */ (context.path.at(-1));
2020

21-
// special case
22-
if (node.name === 'value') {
23-
if (parent.type === 'RegularElement' && parent.name === 'option') {
24-
mark_subtree_dynamic(context.path);
25-
}
26-
}
27-
28-
// special case loading="lazy"
29-
if (node.name === 'loading') {
30-
if (parent.type === 'RegularElement' && parent.name === 'img') {
31-
mark_subtree_dynamic(context.path);
32-
}
21+
if (
22+
// special case for <option value=""/>
23+
(node.name === 'value' && parent.type === 'RegularElement' && parent.name === 'option') ||
24+
// special case <img loading="lazy" />
25+
(node.name === 'loading' && parent.type === 'RegularElement' && parent.name === 'img')
26+
) {
27+
mark_subtree_dynamic(context.path);
3328
}
3429

3530
if (node.name.startsWith('on')) {

0 commit comments

Comments
 (0)