Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
// clear any other DOM nodes, there should be only a single entry for the root
if ((flags & VNodeFlags.Fragment) === 0) {
let nextSibling: Node | null = null;
while (currentNode) {
nextSibling = currentNode.nextSibling;
parentNode.removeChild(currentNode);
currentNode = nextSibling;
}
}
} else if (!isNull(parentNode.firstChild) && !isSamePropsInnerHTML(parentNode, props)) {
parentNode.textContent = ''; // dom has content, but VNode has no children remove everything from DOM
if (flags & VNodeFlags.FormElement) {
// If element is form element, we need to clear defaultValue also
(parentNode as any).defaultValue = '';
}
}
}
if (!isNullOrUndef(children) && isNullOrUndef(props.children)) {
props.children = children;
}
if (vNode.flags & VNodeFlags.Component) {
if (isString(vNode.type)) {
vNode.flags = getFlagsForElementVnode(vNode.type as string);
if (props) {
normalizeProps(vNode);
}
}
}
const flags = vNode.flags;
if (flags & VNodeFlags.FormElement) {
normalizeFormProps(vNode.type, props);
}
if (flags & VNodeFlags.Element) {
if (vNode.className) {
props.className = vNode.className;
}
normalizeGenericProps(props);
}
if (oldCreateVNode) {
oldCreateVNode(vNode);
}
};