Skip to content

Commit 46dcfca

Browse files
committed
we can do sanitize_slots like this now (more correct anyway since it should be booleans)
1 parent 3494f4c commit 46dcfca

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/svelte/src/internal/client/render.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,11 @@ export function unmount(component) {
322322
* @returns {Record<string, any>}
323323
*/
324324
export function sanitize_slots(props) {
325-
const sanitized = { ...props.$$slots };
326-
if (props.children) sanitized.default = props.children;
325+
/** @type {Record<string, boolean>} */
326+
const sanitized = {};
327+
for (const key in props.$$slots) {
328+
sanitized[key] = true;
329+
}
327330
return sanitized;
328331
}
329332

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,11 @@ export function sanitize_props(props) {
555555
* @returns {Record<string, any>}
556556
*/
557557
export function sanitize_slots(props) {
558-
const sanitized = { ...props.$$slots };
559-
if (props.children) sanitized.default = props.children;
558+
/** @type {Record<string, boolean>} */
559+
const sanitized = {};
560+
for (const key in props.$$slots) {
561+
sanitized[key] = true;
562+
}
560563
return sanitized;
561564
}
562565

0 commit comments

Comments
 (0)