MCPcopy Index your code
hub / github.com/ampproject/amphtml / createSubtree

Function createSubtree

test/unit/core/context/test-node-values.js:45–56  ·  view source on GitHub ↗
(id, children, depth)

Source from the content-addressed store, hash-verified

43
44 tree = (() => {
45 function createSubtree(id, children, depth) {
46 const el = doc.createElement('div');
47 el.id = id;
48 el.textContent = id;
49 if (depth > 1) {
50 for (let i = 0; i < children; i++) {
51 const child = createSubtree(`${id}-${i + 1}`, children, depth - 1);
52 el.appendChild(child);
53 }
54 }
55 return el;
56 }
57 return createSubtree('T', 4, 4);
58 })();
59

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected