Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// Voided element, push directly to queue
if (isVoidElement) {
this.addToQueue(renderedString, position);
// Regular element with content
} else {
// Element has children, build them in
const childFlags = vNode.childFlags;
if (childFlags === ChildFlags.HasVNodeChildren) {
this.addToQueue(renderedString, position);
this.renderVNodeToQueue(children, context, position);
this.addToQueue('', position);
return;
} else if (childFlags === ChildFlags.HasTextChildren) {
this.addToQueue(renderedString, position);
this.addToQueue(children === '' ? ' ' : escapeText(children + ''), position);
this.addToQueue('', position);
return;
} else if (childFlags & ChildFlags.MultipleChildren) {
this.addToQueue(renderedString, position);
for (let i = 0, len = children.length; i < len; ++i) {
this.renderVNodeToQueue(children[i], context, position);
}
this.addToQueue('', position);
return;
}
if (html) {
this.addToQueue(renderedString + html + '', position);
return;
}
renderedString += ` selected`;
}
}
if (isVoidElement) {
renderedString += `>`;
} else {
renderedString += `>`;
const childFlags = vNode.childFlags;
if (childFlags === ChildFlags.HasVNodeChildren) {
renderedString += renderVNodeToString(children, vNode, context);
} else if (childFlags & ChildFlags.MultipleChildren) {
for (let i = 0, len = children.length; i < len; ++i) {
renderedString += renderVNodeToString(children[i], vNode, context);
}
} else if (childFlags === ChildFlags.HasTextChildren) {
renderedString += children === '' ? ' ' : escapeText(children);
} else if (html) {
renderedString += html;
}
if (!isVoidElement) {
renderedString += ``;
}
}
if (String(type).match(/[\s\n\/='"\0<>]/)) {
throw renderedString;
}
return renderedString;
} else if ((flags & VNodeFlags.Text) !== 0) {
return children === '' ? ' ' : escapeText(children);
public renderChildren(children: VNode[] | VNode | string, context: any, childFlags: ChildFlags) {
if (childFlags === ChildFlags.HasVNodeChildren) {
return this.renderNode(children, context);
}
if (childFlags === ChildFlags.HasTextChildren) {
return this.push(children === '' ? ' ' : escapeText(children + ''));
}
if (childFlags & ChildFlags.MultipleChildren) {
return (children as VNode[]).reduce((p, child) => {
return p.then(() => {
return Promise.resolve(this.renderNode(child, context)).then(() => !!(child.flags & VNodeFlags.Text));
});
}, Promise.resolve(false));
}
}
function hydrateChildren(parentVNode: VNode, parentNode, currentNode, context, isSVG, lifecycle: Function[]) {
const childFlags = parentVNode.childFlags;
const children = parentVNode.children;
const props = parentVNode.props;
const flags = parentVNode.flags;
if (childFlags !== ChildFlags.HasInvalidChildren) {
if (childFlags === ChildFlags.HasVNodeChildren) {
if (isNull(currentNode)) {
_M(children as VNode, parentNode, context, isSVG, null, lifecycle);
} else {
currentNode = hydrateVNode(children as VNode, parentNode, currentNode as Element, context, isSVG, lifecycle);
currentNode = currentNode ? currentNode.nextSibling : null;
}
} else if (childFlags === ChildFlags.HasTextChildren) {
if (isNull(currentNode)) {
parentNode.appendChild(document.createTextNode(children as string));
} else if (parentNode.childNodes.length !== 1 || currentNode.nodeType !== 3) {
parentNode.textContent = children as string;
} else {
if (currentNode.nodeValue !== children) {
currentNode.nodeValue = children as string;
}
}
currentNode = null;
} else if (childFlags & ChildFlags.MultipleChildren) {
let prevVNodeIsTextNode = false;
for (let i = 0, len = (children as VNode[]).length; i < len; ++i) {
const child = (children as VNode[])[i];