Skip to content

Commit

Permalink
fix: correctly handle srcObject attribute on video elements (#14369)
Browse files Browse the repository at this point in the history
* fix: correctly handle srcObject attribute on video elements

* remove side-effect

* side-effects agin

* side-effects agin

* better fix
  • Loading branch information
trueadm authored Nov 20, 2024
1 parent 7bd1cdf commit 811c8d3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-jokes-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: correctly handle srcObject attribute on video elements
6 changes: 4 additions & 2 deletions packages/svelte/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ const ATTRIBUTE_ALIASES = {
ismap: 'isMap',
nomodule: 'noModule',
playsinline: 'playsInline',
readonly: 'readOnly'
readonly: 'readOnly',
srcobject: 'srcObject'
};

/**
Expand All @@ -212,7 +213,8 @@ const DOM_PROPERTIES = [
'readOnly',
'value',
'inert',
'volume'
'volume',
'srcObject'
];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test } from '../../test';

export default test({
html: `<video></video>`,

test({ assert, target }) {
const video = target.querySelector('video');

// @ts-ignore
assert.deepEqual(video?.srcObject, {});
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
let srcObject = $state();
$effect(() => {
srcObject = {};
})
</script>

<video {srcObject}></video>

0 comments on commit 811c8d3

Please sign in to comment.