Skip to content
Merged
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
10 changes: 4 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h, cloneElement, render, hydrate, Fragment } from 'preact';
import { h, cloneElement, render, hydrate } from 'preact';

/**
* @typedef {import('./internal.d.ts').PreactCustomElement} PreactCustomElement
Expand Down Expand Up @@ -177,8 +177,7 @@ function Slot(props, context) {
}
}
};
const { useFragment, ...rest } = props;
return h(useFragment ? Fragment : 'slot', { ...rest, ref });
return h('slot', { ...props, ref });
}

function toVdom(element, nodeName, options) {
Expand Down Expand Up @@ -210,9 +209,8 @@ function toVdom(element, nodeName, options) {
const shadow = !!(options && options.shadow);

// Only wrap the topmost node with a slot
const wrappedChildren = nodeName
? h(Slot, { useFragment: !shadow }, children)
: children;
const wrappedChildren =
nodeName && shadow ? h(Slot, null, children) : children;

if (!shadow && nodeName) {
element.innerHTML = '';
Expand Down