Skip to content

Commit eb7a516

Browse files
committed
better server attribute stringification
1 parent 7c629e8 commit eb7a516

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/svelte/src/internal/server/blocks/svelte-html.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/** @import { Payload } from '#server' */
22

3-
import { escape_html } from '../../../escaping.js';
43
import { svelte_html_duplicate_attribute } from '../../shared/warnings.js';
54

65
/**
@@ -14,12 +13,12 @@ export function svelte_html(payload, attributes) {
1413
if (payload.htmlAttributes.has(name)) {
1514
if (name === 'class') {
1615
// Don't bother deduplicating class names, the browser handles it just fine
17-
value = `${payload.htmlAttributes.get(name)} ${value}`;
16+
value = `${payload.htmlAttributes.get(name)} ${value}`.trim();
1817
} else {
1918
svelte_html_duplicate_attribute(name);
2019
}
2120
}
2221

23-
payload.htmlAttributes.set(name, escape_html(value, true));
22+
payload.htmlAttributes.set(name, value);
2423
}
2524
}

packages/svelte/src/internal/server/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ export function render(component, options = {}) {
143143
html: payload.out,
144144
body: payload.out,
145145
htmlAttributes: [...payload.htmlAttributes]
146-
.map(([name, value]) => `${name}="${value}"`)
147-
.join(' ')
146+
.map(([name, value]) => attr(name, value, is_boolean_attribute(name)))
147+
.join('')
148+
.trim()
148149
};
149150
}
150151

0 commit comments

Comments
 (0)