MCPcopy
hub / github.com/webpack/webpack / appendTo

Function appendTo

lib/html/syntax.js:4705–4717  ·  view source on GitHub ↗
(
		/** @type {HtmlElement | HtmlDocument | HtmlDocumentFragment} */ parent,
		/** @type {HtmlNode} */ node
	)

Source from the content-addressed store, hash-verified

4703 : parent.children;
4704
4705 const appendTo = (
4706 /** @type {HtmlElement | HtmlDocument | HtmlDocumentFragment} */ parent,
4707 /** @type {HtmlNode} */ node
4708 ) => {
4709 const arr = childrenOf(parent);
4710 const last = arr[arr.length - 1];
4711 if (node.type === NodeType.Text && last && last.type === NodeType.Text) {
4712 last.data += node.data;
4713 if (node.end !== undefined) last.end = node.end;
4714 return;
4715 }
4716 arr.push(node);
4717 };
4718
4719 // Reused result of `appropriatePlace` — consumed synchronously by
4720 // `insertAtPlace` and never retained, so one shared object avoids an

Callers 2

insertAtPlaceFunction · 0.85
adoptionAgencyFunction · 0.85

Calls 2

childrenOfFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected