Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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/pink-gifts-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: correctly SSR hidden="until-found"
4 changes: 4 additions & 0 deletions packages/svelte/src/internal/shared/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const replacements = {
*/
export function attr(name, value, is_boolean = false) {
if (value == null || (!value && is_boolean)) return '';
// attribute hidden for values other than "until-found" behaves like a boolean attribute
if (name === 'hidden' && value !== 'until-found') {
is_boolean = true;
}
const normalized = (name in replacements && replacements[name].get(value)) || value;
const assignment = is_boolean ? '' : `="${escape_html(normalized, true)}"`;
return ` ${name}${assignment}`;
Expand Down
1 change: 0 additions & 1 deletion packages/svelte/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ const DOM_BOOLEAN_ATTRIBUTES = [
'default',
'disabled',
'formnovalidate',
'hidden',
'indeterminate',
'inert',
'ismap',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!--[--><div>A</div><div hidden>B</div><div hidden="until-found">C</div><!--]-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div {...{ hidden: false }}>A</div>
<div {...{ hidden: true }}>B</div>
<div {...{ hidden: 'until-found' }}>C</div>
Loading