Comparing version 0.0.10 to 0.0.11
@@ -158,3 +158,3 @@ "use strict"; | ||
} | ||
else { | ||
else if (newChild instanceof VirtualNode_1.default) { | ||
this.diff(newChild, oldChild, oldElement.childNodes[childIndex]); | ||
@@ -161,0 +161,0 @@ } |
@@ -9,3 +9,3 @@ import { IVirtualNode, IVirtualNodeProps } from './IVirtualNode'; | ||
constructor(type: string, props?: T, ...children: Array<IVirtualNode<any> | string | number>); | ||
private fixChildrenArrays(children); | ||
private fixChildrenArrays(children, fixedChildren?); | ||
toNode(): HTMLElement; | ||
@@ -12,0 +12,0 @@ toString(): string; |
@@ -13,14 +13,14 @@ "use strict"; | ||
} | ||
VirtualNode.prototype.fixChildrenArrays = function (children) { | ||
var fixedChildren = []; | ||
VirtualNode.prototype.fixChildrenArrays = function (children, fixedChildren) { | ||
fixedChildren = fixedChildren || []; | ||
for (var index = 0, length = children.length; index < length; index++) { | ||
var child = children[index]; | ||
if (child instanceof Array) { | ||
for (var childIndex = 0, childLength = child.length; childIndex < childLength; childIndex++) { | ||
fixedChildren.push(child[childIndex]); | ||
if (typeof child !== 'undefined') { | ||
if (child instanceof Array) { | ||
this.fixChildrenArrays(child, fixedChildren); | ||
} | ||
else { | ||
fixedChildren.push(child); | ||
} | ||
} | ||
else { | ||
fixedChildren.push(child); | ||
} | ||
} | ||
@@ -39,4 +39,2 @@ return fixedChildren; | ||
switch (typeof child) { | ||
case 'undefined': | ||
break; | ||
case 'string': | ||
@@ -48,4 +46,12 @@ node.appendChild(document.createTextNode(child)); | ||
break; | ||
case 'object': | ||
if (child) { | ||
if (child.toNode) { | ||
node.appendChild(child.toNode()); | ||
} | ||
else { | ||
node.appendChild(document.createTextNode(child.toString())); | ||
} | ||
} | ||
default: | ||
node.appendChild(child.toNode()); | ||
break; | ||
@@ -52,0 +58,0 @@ } |
{ | ||
"name": "cascade", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "A library for creating modern user interfaces.", | ||
@@ -5,0 +5,0 @@ "author": "Sean Johnson <sjohnson@sjohnsonaz.com>", |
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
104201
2724