Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elementToNode(element) {
return elementToTree(element);
}
function elementToTree(el) {
if (!isPortal(el)) {
return utilElementToTree(el, elementToTree);
}
const { children, containerInfo } = el;
const props = { children, containerInfo };
return {
nodeType: 'portal',
type: Portal,
props,
key: ensureKeyOrUndefined(el.key),
ref: el.ref || null,
instance: null,
rendered: elementToTree(el.children),
};
}
function elementToTree(el) {
if (!isPortal(el)) {
return utilElementToTree(el, elementToTree);
}
const { children, containerInfo } = el;
const props = { children, containerInfo };
return {
nodeType: 'portal',
type: Portal,
props,
key: ensureKeyOrUndefined(el.key),
ref: el.ref || null,
instance: null,
rendered: elementToTree(el.children),
};
}
getNode() {
if (isDOM) {
return elementToTree(cachedNode);
}
const output = renderer.getRenderOutput();
return {
nodeType: typeToNodeType(cachedNode.type),
type: cachedNode.type,
props: cachedNode.props,
key: ensureKeyOrUndefined(cachedNode.key),
ref: cachedNode.ref,
instance: renderer._instance._instance,
rendered: elementToTree(output),
};
},
simulateEvent(node, event, ...args) {
elementToNode(element) {
return elementToTree(element);
}
getNode() {
if (isDOM) {
return elementToTree(cachedNode);
}
const output = renderer.getRenderOutput();
return {
nodeType: typeToNodeType(cachedNode.type),
type: cachedNode.type,
props: cachedNode.props,
key: ensureKeyOrUndefined(cachedNode.key),
ref: cachedNode.ref,
instance: renderer._instance._instance,
rendered: elementToTree(output),
};
},
simulateEvent(node, event, ...args) {
getNode() {
if (isDOM) {
return elementToTree(cachedNode);
}
const output = renderer.getRenderOutput();
return {
nodeType: compositeTypeToNodeType(renderer._instance._compositeType),
type: cachedNode.type,
props: cachedNode.props,
key: ensureKeyOrUndefined(cachedNode.key),
ref: cachedNode.ref,
instance: renderer._instance._instance,
rendered: elementToTree(output),
};
},
simulateEvent(node, event, ...args) {
getNode() {
if (isDOM) {
return elementToTree(cachedNode)
}
const output = renderer.getRenderOutput()
return {
nodeType: nodeTypeFromType(cachedNode.type),
type: cachedNode.type,
props: cachedNode.props,
key: ensureKeyOrUndefined(cachedNode.key),
ref: cachedNode.ref,
instance: renderer._instance,
rendered: Array.isArray(output)
? flatten(output).map(elementToTree)
: elementToTree(output),
}
},
simulateEvent(node, event, ...args) {