MCPcopy Create free account
hub / github.com/ampproject/amphtml / createSubtree

Function createSubtree

test/unit/core/context/test-node-subscribers.js:42–53  ·  view source on GitHub ↗
(id, children, depth)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected