From 900e482e229cf55d3ce8c786f04e6ef7856028f3 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Wed, 20 Nov 2024 13:55:48 +0000 Subject: [PATCH] revert changes --- .../compiler/phases/2-analyze/visitors/Attribute.js | 4 ---- .../phases/2-analyze/visitors/RegularElement.js | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/svelte/src/compiler/phases/2-analyze/visitors/Attribute.js b/packages/svelte/src/compiler/phases/2-analyze/visitors/Attribute.js index ec48414bf6..ca0ea55d1f 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/visitors/Attribute.js +++ b/packages/svelte/src/compiler/phases/2-analyze/visitors/Attribute.js @@ -30,10 +30,6 @@ export function Attribute(node, context) { } } - if (node.name === 'autofocus' || node.name === 'muted') { - mark_subtree_dynamic(context.path); - } - if (node.name.startsWith('on')) { mark_subtree_dynamic(context.path); } diff --git a/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js b/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js index 7d1c4aaeaa..60bd1dd0c5 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js +++ b/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js @@ -75,6 +75,16 @@ export function RegularElement(node, context) { node.attributes.push(create_attribute('value', child.start, child.end, [child])); } + if ( + node.attributes.some( + (attribute) => + attribute.type === 'Attribute' && + (attribute.name === 'autofocus' || attribute.name === 'muted') + ) + ) { + mark_subtree_dynamic(context.path); + } + const binding = context.state.scope.get(node.name); if ( binding !== null &&