Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
toArray: function (children) {
if (isNullOrUndef(children)) {
return [];
}
// We need to flatten arrays here,
// because React does it also and application level code might depend on that behavior
if (isArray(children)) {
const result = [];
flatten(children, result);
return result;
}
return ARR.concat(children);
}
};
if (isString(className)) {
renderedString += ` class="${escapeText(className)}"`;
} else if (isNumber(className)) {
renderedString += ` class="${className}"`;
}
if (!isNull(props)) {
for (const prop in props) {
const value = props[prop];
switch (prop) {
case 'dangerouslySetInnerHTML':
html = value.__html;
break;
case 'style':
if (!isNullOrUndef(props.style)) {
renderedString += ` style="${renderStylesToString(props.style)}"`;
}
break;
case 'children':
case 'className':
// Ignore
break;
case 'defaultValue':
// Use default values if normal values are not present
if (!props.value) {
renderedString += ` value="${isString(value) ? escapeText(value) : value}"`;
}
break;
case 'defaultChecked':
// Use default values if normal values are not present
if (!props.checked) {
toArray(children: Array): Array {
if (isNullOrUndef(children)) {
return [];
}
// We need to flatten arrays here,
// because React does it also and application level code might depend on that behavior
if (isArray(children)) {
const result = [];
flatten(children, result);
return result;
}
return ARR.concat(children);
}
};
if (isString(className)) {
renderedString += ` class="${escapeText(className)}"`;
} else if (isNumber(className)) {
renderedString += ` class="${className}"`;
}
if (!isNull(props)) {
for (const prop in props) {
const value = props[prop];
switch (prop) {
case 'dangerouslySetInnerHTML':
html = value.__html;
break;
case 'style':
if (!isNullOrUndef(props.style)) {
renderedString += ` style="${renderStylesToString(props.style)}"`;
}
break;
case 'children':
case 'className':
// Ignore
break;
case 'defaultValue':
// Use default values if normal values are not present
if (!props.value) {
renderedString += ` value="${isString(value) ? escapeText(value) : value}"`;
}
break;
case 'defaultChecked':
// Use default values if normal values are not present
if (!props.checked) {
options.createVNode = (vNode: VNode) => {
const children = vNode.children as any;
let props: any = vNode.props;
if (isNullOrUndef(props)) {
props = vNode.props = {};
}
// React supports iterable children, in addition to Array-like
if (hasSymbolSupport && !isNull(children) && typeof children === 'object' && !isArray(children) && isFunction(children[symbolIterator])) {
vNode.children = iterableToArray(children[symbolIterator]());
}
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 (isString(className)) {
renderedString += ` class="${escapeText(className)}"`;
} else if (isNumber(className)) {
renderedString += ` class="${className}"`;
}
if (!isNull(props)) {
for (const prop in props) {
const value = props[prop];
switch (prop) {
case 'dangerouslySetInnerHTML':
html = value.__html;
break;
case 'style':
if (!isNullOrUndef(props.style)) {
renderedString += ` style="${renderStylesToString(props.style)}"`;
}
break;
case 'children':
case 'className':
// Ignore
break;
case 'defaultValue':
// Use default values if normal values are not present
if (!props.value) {
renderedString += ` value="${isString(value) ? escapeText(value) : value}"`;
}
break;
case 'defaultChecked':
// Use default values if normal values are not present
if (!props.checked) {
function verifyKeys(vNodes) {
if (Array.isArray(vNodes)) {
const keyValues = vNodes.map(function(vnode) {
return vnode.key;
});
const isDuplicate = keyValues.some(function(item, idx) {
return keyValues.indexOf(item) !== idx;
});
expect(isDuplicate).toEqual(false);
for (let i = 0; i < vNodes.length; i++) {
verifyKeys(vNodes[i].children);
}
} else if (!isNullOrUndef(vNodes) && !!vNodes.flags) {
verifyKeys(vNodes.children);
}
}
isSVG = isSVG || (flags & VNodeFlags.SvgElement) > 0;
if (dom.nodeType !== 1 || dom.tagName.toLowerCase() !== vNode.type) {
if (process.env.NODE_ENV !== 'production') {
warning("Inferno hydration: Server-side markup doesn't match client-side markup");
}
_ME(vNode, null, context, isSVG, null, lifecycle);
parentDOM.replaceChild(vNode.dom as Element, dom);
} else {
vNode.dom = dom;
hydrateChildren(vNode, dom, dom.firstChild, context, isSVG, lifecycle);
if (!isNull(props)) {
_MP(vNode, flags, props, dom, isSVG);
}
if (isNullOrUndef(className)) {
if (dom.className !== '') {
dom.removeAttribute('class');
}
} else if (isSVG) {
dom.setAttribute('class', className);
} else {
dom.className = className;
}
_MR(ref, dom, lifecycle);
}
return vNode.dom;
}