MCPcopy Index your code
hub / github.com/angular/angular / createTableDom

Function createTableDom

modules/benchmarks/src/hydration/init.ts:89–122  ·  view source on GitHub ↗

* Creates DOM to represent a table, similar to what'd be generated * during the SSR.

(data: TableCell[][])

Source from the content-addressed store, hash-verified

87 * during the SSR.
88 */
89function createTableDom(data: TableCell[][]) {
90 const table = document.createElement('table');
91 const tbody = document.createElement('tbody');
92 table.appendChild(tbody);
93 for (let r = 0; r < data.length; r++) {
94 const dataRow = data[r];
95 const tr = document.createElement('tr');
96 // Mark created DOM nodes, so that we can verify that
97 // they were *not* re-created during hydration.
98 (tr as any).__existing = true;
99 tbody.appendChild(tr);
100 const renderRow = [];
101 for (let c = 0; c < dataRow.length; c++) {
102 const dataCell = dataRow[c];
103 const renderCell = document.createElement('td');
104 // Mark created DOM nodes, so that we can verify that
105 // they were *not* re-created during hydration.
106 (renderCell as any).__existing = true;
107 if (r % 2 === 0) {
108 renderCell.style.backgroundColor = 'grey';
109 }
110 tr.appendChild(renderCell);
111 renderRow[c] = renderCell;
112 renderCell.textContent = dataCell.value;
113 }
114 // View container anchor
115 const comment = document.createComment('');
116 tr.appendChild(comment);
117 }
118 // View container anchor
119 const comment = document.createComment('');
120 tbody.appendChild(comment);
121 return table;
122}

Callers 1

prepareFunction · 0.85

Calls 3

createElementMethod · 0.65
appendChildMethod · 0.65
createCommentMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…