Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wise-timers-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: ensure muted DOM property works correctly in FF
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export function RegularElement(node, context) {

if (
node.attributes.some(
(attribute) => attribute.type === 'Attribute' && attribute.name === 'autofocus'
(attribute) =>
attribute.type === 'Attribute' &&
(attribute.name === 'autofocus' || attribute.name === 'muted')
)
) {
mark_subtree_dynamic(context.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export function RegularElement(node, context) {
if (
!is_custom_element &&
attribute.name !== 'autofocus' &&
attribute.name !== 'muted' &&
(attribute.value === true || is_text_attribute(attribute))
) {
const name = get_attribute_name(node, attribute);
Expand Down Expand Up @@ -530,6 +531,11 @@ function build_element_attribute_update_assignment(element, node_id, attribute,
return false;
}

if (name === 'muted') {
state.init.push(b.stmt(b.assignment('=', b.member(node_id, b.id('muted')), value)));
return false;
}

/** @type {Statement} */
let update;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function is_static_element(node) {
return false;
}

if (attribute.name === 'autofocus') {
if (attribute.name === 'autofocus' || attribute.name === 'muted') {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<div><video class="svelte-xyz" autoplay muted></video>
<video muted></video></div>
<div><video class="svelte-xyz" autoplay></video>
<video></video></div>