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

Function liveListInsert

build-system/server/app.js:642–655  ·  view source on GitHub ↗

* @param {Element} liveList * @param {Element} node

(liveList, node)

Source from the content-addressed store, hash-verified

640 * @param {Element} node
641 */
642function liveListInsert(liveList, node) {
643 const iterCount = Math.floor(Math.random() * 2) + 1;
644 logWithoutTimestamp(`inserting ${iterCount} item(s)`);
645 for (let i = 0; i < iterCount; i++) {
646 /**
647 * TODO(#28387) this type cast may be hiding a bug.
648 * @type {Element}
649 */
650 const child = /** @type {*} */ (node.cloneNode(true));
651 child.setAttribute('id', `list-item-${itemCtr++}`);
652 child.setAttribute('data-sort-time', Date.now().toString());
653 liveList.querySelector('[items]')?.appendChild(child);
654 }
655}
656
657/**
658 * @param {Element} liveList

Callers 1

app.jsFile · 0.85

Calls 5

logWithoutTimestampFunction · 0.85
cloneNodeMethod · 0.80
nowMethod · 0.80
setAttributeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected