Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const renderOutput = instance.render(props, instance.state, instance.context);
// In case render returns invalid stuff
if (isInvalid(renderOutput)) {
return '';
}
if (isString(renderOutput)) {
return escapeText(renderOutput);
}
if (isNumber(renderOutput)) {
return renderOutput + '';
}
return renderVNodeToString(renderOutput, vNode, childContext);
} else {
const renderOutput = type(props, context);
if (isInvalid(renderOutput)) {
return '';
}
if (isString(renderOutput)) {
return escapeText(renderOutput);
}
if (isNumber(renderOutput)) {
return renderOutput + '';
}
return renderVNodeToString(renderOutput, vNode, context);
}
} else if ((flags & VNodeFlags.Element) !== 0) {
let renderedString = `<${type}`;
let html;
const isVoidElement = voidElements.has(type);
const className = vNode.className;
instance.state = pending;
} else {
for (const key in pending) {
state[key] = pending[key];
}
}
instance.$PSS = false;
instance.$PS = null;
}
}
if (hasNewAPI) {
instance.state = createDerivedState(instance, props, instance.state);
}
const renderOutput = instance.render(props, instance.state, instance.context);
// In case render returns invalid stuff
if (isInvalid(renderOutput)) {
return '';
}
if (isString(renderOutput)) {
return escapeText(renderOutput);
}
if (isNumber(renderOutput)) {
return renderOutput + '';
}
return renderVNodeToString(renderOutput, vNode, childContext);
} else {
const renderOutput = type(props, context);
if (isInvalid(renderOutput)) {
return '';
}
if (isString(renderOutput)) {
}
const renderOutput = instance.render(instance.props, instance.state, instance.context);
if (isInvalid(renderOutput)) {
this.addToQueue('', position);
} else if (isString(renderOutput)) {
this.addToQueue(escapeText(renderOutput), position);
} else if (isNumber(renderOutput)) {
this.addToQueue(renderOutput + '', position);
} else {
this.renderVNodeToQueue(renderOutput, context, position);
}
} else {
const renderOutput = type(props, context);
if (isInvalid(renderOutput)) {
this.addToQueue('', position);
} else if (isString(renderOutput)) {
this.addToQueue(escapeText(renderOutput), position);
} else if (isNumber(renderOutput)) {
this.addToQueue(renderOutput + '', position);
} else {
this.renderVNodeToQueue(renderOutput, context, position);
}
}
// If an element
} else if ((flags & VNodeFlags.Element) > 0) {
let renderedString = `<${type}`;
let html;
const isVoidElement = voidElements.has(type);
const className = vNode.className;
export function hydrate(input, parentDOM: Element, callback?: Function) {
let dom = parentDOM.firstChild as Element;
if (isNull(dom)) {
if (process.env.NODE_ENV !== 'production') {
warning("Inferno hydration: Server-side markup doesn't match client-side markup");
}
render(input, parentDOM, callback);
} else {
const lifecycle: Function[] = [];
if (!isInvalid(input)) {
dom = hydrateVNode(input, parentDOM, dom, {}, false, lifecycle) as Element;
}
// clear any other DOM nodes, there should be only a single entry for the root
while (dom && (dom = dom.nextSibling as Element)) {
parentDOM.removeChild(dom);
}
if (lifecycle.length > 0) {
let listener;
while ((listener = lifecycle.shift()) !== undefined) {
listener();
}
}
}
(parentDOM as any).$V = input;
return promisePosition;
}),
position
);
return;
} else {
instance.props = combineFrom(instance.props, initialProps);
}
}
}
if (hasNewAPI) {
instance.state = createDerivedState(instance, props, instance.state);
}
const renderOutput = instance.render(instance.props, instance.state, instance.context);
if (isInvalid(renderOutput)) {
this.addToQueue('', position);
} else if (isString(renderOutput)) {
this.addToQueue(escapeText(renderOutput), position);
} else if (isNumber(renderOutput)) {
this.addToQueue(renderOutput + '', position);
} else {
this.renderVNodeToQueue(renderOutput, context, position);
}
} else {
const renderOutput = type(props, context);
if (isInvalid(renderOutput)) {
this.addToQueue('', position);
} else if (isString(renderOutput)) {
this.addToQueue(escapeText(renderOutput), position);
} else if (isNumber(renderOutput)) {
public renderComponent(vComponent, context, isClass) {
const type = vComponent.type;
const props = vComponent.props;
if (!isClass) {
const renderOutput = type(props, context);
if (isInvalid(renderOutput)) {
return this.push('');
}
if (isString(renderOutput)) {
return this.push(escapeText(renderOutput));
}
if (isNumber(renderOutput)) {
return this.push(renderOutput + '');
}
return this.renderNode(renderOutput, context);
}
const instance = new type(props, context);
const hasNewAPI = Boolean(type.getDerivedStateFromProps);
instance.$BS = false;
instance.$SSR = true;
forEach(children: Array, fn: IterateChildrenFn, ctx?: any): void {
if (isNullOrUndef(children)) {
return;
}
children = Children.toArray(children);
if (ctx) {
fn = fn.bind(ctx);
}
for (let i = 0, len = children.length; i < len; ++i) {
const child = isInvalid(children[i]) ? null : children[i];
fn(child, i, children);
}
},
count(children: Array): number {
public render(): VNode | null {
const { route } = this.context.router;
const { children } = this.props;
const location = this.props.location || route.location;
if (isInvalid(children)) {
return null;
}
const { match, _child } = extractMatchFromChildren(children, route, location);
if (match) {
return createComponentVNode(_child.flags, _child.type, combineFrom(_child.props, { location, computedMatch: match }));
}
return null;
}
}
initialProps.then(dataForContext => {
if (typeof dataForContext === 'object') {
instance.props = combineFrom(instance.props, dataForContext);
}
const renderOut = instance.render(instance.props, instance.state, instance.context);
if (isInvalid(renderOut)) {
this.addToQueue('', promisePosition);
} else if (isString(renderOut)) {
this.addToQueue(escapeText(renderOut), promisePosition);
} else if (isNumber(renderOut)) {
this.addToQueue(renderOut + '', promisePosition);
} else {
this.renderVNodeToQueue(renderOut, instance.context, promisePosition);
}
setTimeout(this.pushQueue, 0);
return promisePosition;
}),
position
instance.state = pending;
} else {
for (const key in pending) {
state[key] = pending[key];
}
}
instance.$PS = null;
}
instance.$BR = false;
if (hasNewAPI) {
instance.state = createDerivedState(instance, props, instance.state);
}
const renderOutput = instance.render(instance.props, instance.state, instance.context);
if (isInvalid(renderOutput)) {
return this.push('');
}
if (isString(renderOutput)) {
return this.push(escapeText(renderOutput));
}
if (isNumber(renderOutput)) {
return this.push(renderOutput + '');
}
return this.renderNode(renderOutput, context);
});
}