Comparing version 0.0.29 to 0.0.30
@@ -257,5 +257,5 @@ "use strict"; | ||
// Children will not be an array if single item | ||
const forgoChildren = Array.isArray(forgoChildrenObj) | ||
const forgoChildren = (Array.isArray(forgoChildrenObj) | ||
? forgoChildrenObj | ||
: [forgoChildrenObj]; | ||
: [forgoChildrenObj]).filter((x) => typeof x !== "undefined" && x !== null); | ||
let forgoChildIndex = 0; | ||
@@ -267,18 +267,16 @@ if (forgoChildren) { | ||
if (!isForgoElement(forgoChild)) { | ||
if (forgoChild !== undefined && forgoChild !== null) { | ||
// If the first node is a text node, we could pass that along. | ||
// No need to replace here, callee does that. | ||
if (childNodes[forgoChildIndex] && | ||
childNodes[forgoChildIndex].nodeType === TEXT_NODE_TYPE) { | ||
internalRender(stringOfPrimitiveNode(forgoChild), childNodes[forgoChildIndex], [], fullRerender, boundary); | ||
// If the first node is a text node, we could pass that along. | ||
// No need to replace here, callee does that. | ||
if (childNodes[forgoChildIndex] && | ||
childNodes[forgoChildIndex].nodeType === TEXT_NODE_TYPE) { | ||
internalRender(stringOfPrimitiveNode(forgoChild), childNodes[forgoChildIndex], [], fullRerender, boundary); | ||
} | ||
// But otherwise, don't pass a replacement node. Just insert instead. | ||
else { | ||
const { node } = internalRender(stringOfPrimitiveNode(forgoChild), undefined, [], fullRerender, boundary); | ||
if (childNodes.length > forgoChildIndex) { | ||
parentElement.insertBefore(node, childNodes[forgoChildIndex]); | ||
} | ||
// But otherwise, don't pass a replacement node. Just insert instead. | ||
else { | ||
const { node } = internalRender(stringOfPrimitiveNode(forgoChild), undefined, [], fullRerender, boundary); | ||
if (childNodes.length > forgoChildIndex) { | ||
parentElement.insertBefore(node, childNodes[forgoChildIndex]); | ||
} | ||
else { | ||
parentElement.appendChild(node); | ||
} | ||
parentElement.appendChild(node); | ||
} | ||
@@ -285,0 +283,0 @@ } |
{ | ||
"name": "forgo", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"main": "./dist", | ||
@@ -5,0 +5,0 @@ "author": "Jeswin Kumar<jeswinpk@agilehead.com>", |
@@ -539,5 +539,6 @@ declare global { | ||
// Children will not be an array if single item | ||
const forgoChildren = Array.isArray(forgoChildrenObj) | ||
const forgoChildren = (Array.isArray(forgoChildrenObj) | ||
? forgoChildrenObj | ||
: [forgoChildrenObj]; | ||
: [forgoChildrenObj] | ||
).filter((x) => typeof x !== "undefined" && x !== null); | ||
@@ -556,32 +557,30 @@ let forgoChildIndex = 0; | ||
if (!isForgoElement(forgoChild)) { | ||
if (forgoChild !== undefined && forgoChild !== null) { | ||
// If the first node is a text node, we could pass that along. | ||
// No need to replace here, callee does that. | ||
if ( | ||
childNodes[forgoChildIndex] && | ||
childNodes[forgoChildIndex].nodeType === TEXT_NODE_TYPE | ||
) { | ||
internalRender( | ||
stringOfPrimitiveNode(forgoChild), | ||
childNodes[forgoChildIndex], | ||
[], | ||
fullRerender, | ||
boundary | ||
); | ||
} | ||
// But otherwise, don't pass a replacement node. Just insert instead. | ||
else { | ||
const { node } = internalRender( | ||
stringOfPrimitiveNode(forgoChild), | ||
undefined, | ||
[], | ||
fullRerender, | ||
boundary | ||
); | ||
// If the first node is a text node, we could pass that along. | ||
// No need to replace here, callee does that. | ||
if ( | ||
childNodes[forgoChildIndex] && | ||
childNodes[forgoChildIndex].nodeType === TEXT_NODE_TYPE | ||
) { | ||
internalRender( | ||
stringOfPrimitiveNode(forgoChild), | ||
childNodes[forgoChildIndex], | ||
[], | ||
fullRerender, | ||
boundary | ||
); | ||
} | ||
// But otherwise, don't pass a replacement node. Just insert instead. | ||
else { | ||
const { node } = internalRender( | ||
stringOfPrimitiveNode(forgoChild), | ||
undefined, | ||
[], | ||
fullRerender, | ||
boundary | ||
); | ||
if (childNodes.length > forgoChildIndex) { | ||
parentElement.insertBefore(node, childNodes[forgoChildIndex]); | ||
} else { | ||
parentElement.appendChild(node); | ||
} | ||
if (childNodes.length > forgoChildIndex) { | ||
parentElement.insertBefore(node, childNodes[forgoChildIndex]); | ||
} else { | ||
parentElement.appendChild(node); | ||
} | ||
@@ -588,0 +587,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87036
1531