diff --git a/.changeset/bright-jokes-bow.md b/.changeset/bright-jokes-bow.md new file mode 100644 index 0000000000..f70076b869 --- /dev/null +++ b/.changeset/bright-jokes-bow.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: correctly handle srcObject attribute on video elements diff --git a/packages/svelte/src/utils.js b/packages/svelte/src/utils.js index 84c7ca1efb..919660fd6a 100644 --- a/packages/svelte/src/utils.js +++ b/packages/svelte/src/utils.js @@ -192,7 +192,8 @@ const ATTRIBUTE_ALIASES = { ismap: 'isMap', nomodule: 'noModule', playsinline: 'playsInline', - readonly: 'readOnly' + readonly: 'readOnly', + srcobject: 'srcObject' }; /** @@ -212,7 +213,8 @@ const DOM_PROPERTIES = [ 'readOnly', 'value', 'inert', - 'volume' + 'volume', + 'srcObject' ]; /** diff --git a/packages/svelte/tests/runtime-runes/samples/video-src-object/_config.js b/packages/svelte/tests/runtime-runes/samples/video-src-object/_config.js new file mode 100644 index 0000000000..a31b98cac6 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/video-src-object/_config.js @@ -0,0 +1,12 @@ +import { test } from '../../test'; + +export default test({ + html: ``, + + test({ assert, target }) { + const video = target.querySelector('video'); + + // @ts-ignore + assert.deepEqual(video?.srcObject, {}); + } +}); diff --git a/packages/svelte/tests/runtime-runes/samples/video-src-object/main.svelte b/packages/svelte/tests/runtime-runes/samples/video-src-object/main.svelte new file mode 100644 index 0000000000..f4059b028a --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/video-src-object/main.svelte @@ -0,0 +1,10 @@ + + + +