diff --git a/.changeset/strange-apricots-happen.md b/.changeset/strange-apricots-happen.md new file mode 100644 index 0000000000..d61dfb5149 --- /dev/null +++ b/.changeset/strange-apricots-happen.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: set `open` binding value in `
` diff --git a/packages/svelte/src/compiler/phases/bindings.js b/packages/svelte/src/compiler/phases/bindings.js index d8f04e1732..820c66d886 100644 --- a/packages/svelte/src/compiler/phases/bindings.js +++ b/packages/svelte/src/compiler/phases/bindings.js @@ -175,6 +175,7 @@ export const binding_properties = { textContent: {}, open: { event: 'toggle', + type: 'set', valid_elements: ['details'] }, value: { diff --git a/packages/svelte/tests/runtime-runes/samples/details-binding-initial/_config.js b/packages/svelte/tests/runtime-runes/samples/details-binding-initial/_config.js new file mode 100644 index 0000000000..d0ecf31923 --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/details-binding-initial/_config.js @@ -0,0 +1,11 @@ +import { ok, test } from '../../test'; + +export default test({ + test({ assert, target }) { + const details_el = target.querySelector('details'); + + ok(details_el); + + assert.strictEqual(details_el.open, true); + } +}); diff --git a/packages/svelte/tests/runtime-runes/samples/details-binding-initial/main.svelte b/packages/svelte/tests/runtime-runes/samples/details-binding-initial/main.svelte new file mode 100644 index 0000000000..fda553038e --- /dev/null +++ b/packages/svelte/tests/runtime-runes/samples/details-binding-initial/main.svelte @@ -0,0 +1,8 @@ + + +
+ Details + ... +