Skip to content

Commit e5e076c

Browse files
Streamline vdom function signature
1 parent 8934a8a commit e5e076c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function connectedCallback() {
7979
this._vdom = h(
8080
ContextProvider,
8181
{ ...this._props, context },
82-
toVdom(this, true, this._vdomComponent)
82+
toVdom(this, this._vdomComponent)
8383
);
8484
(this.hasAttribute('hydrate') ? hydrate : render)(this._vdom, this._root);
8585
}
@@ -126,7 +126,7 @@ function Slot(props, context) {
126126
return h('slot', { ...props, ref });
127127
}
128128

129-
function toVdom(element, wrap, nodeName) {
129+
function toVdom(element, nodeName) {
130130
if (element.nodeType === 3) return element.data;
131131
if (element.nodeType !== 1) return null;
132132
let children = [],
@@ -142,7 +142,7 @@ function toVdom(element, wrap, nodeName) {
142142
}
143143

144144
for (i = cn.length; i--; ) {
145-
const vnode = toVdom(cn[i], false);
145+
const vnode = toVdom(cn[i], null);
146146
// Move slots correctly
147147
const name = cn[i].slot;
148148
if (name) {
@@ -153,6 +153,6 @@ function toVdom(element, wrap, nodeName) {
153153
}
154154

155155
// Only wrap the topmost node with a slot
156-
const wrappedChildren = wrap ? h(Slot, null, children) : children;
156+
const wrappedChildren = nodeName ? h(Slot, null, children) : children;
157157
return h(nodeName || element.nodeName.toLowerCase(), props, wrappedChildren);
158158
}

0 commit comments

Comments
 (0)