Notebooks: Fix Issue Around Load Error when Tables Have No Rows (#9980)

* Table element children length check

* Add another check
This commit is contained in:
Chris LaFreniere
2020-04-15 12:10:40 -07:00
committed by GitHub
parent 916ac7c7d1
commit 4e92c27189

View File

@@ -307,9 +307,13 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
for (let element of hostElem.children) { for (let element of hostElem.children) {
if (element.nodeName.toLowerCase() === 'table') { if (element.nodeName.toLowerCase() === 'table') {
// add table header and table rows. // add table header and table rows.
children.push(element.children[0]); if (element.children.length > 0) {
for (let trow of element.children[1].children) { children.push(element.children[0]);
children.push(trow); if (element.children.length > 1) {
for (let trow of element.children[1].children) {
children.push(trow);
}
}
} }
} else if (element.children.length > 1) { } else if (element.children.length > 1) {
children = children.concat(this.getChildren(element)); children = children.concat(this.getChildren(element));