MCPcopy
hub / github.com/rrweb-io/rrweb / appendChild

Method appendChild

packages/rrdom/src/document.ts:249–267  ·  view source on GitHub ↗
(newChild: IRRNode)

Source from the content-addressed store, hash-verified

247 }
248
249 public appendChild(newChild: IRRNode): IRRNode {
250 const nodeType = newChild.RRNodeType;
251 if (
252 nodeType === RRNodeType.Element ||
253 nodeType === RRNodeType.DocumentType
254 ) {
255 if (this.childNodes.some((s) => s.RRNodeType === nodeType)) {
256 throw new Error(
257 `RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${
258 nodeType === RRNodeType.Element ? 'RRElement' : 'RRDoctype'
259 } on RRDocument allowed.`,
260 );
261 }
262 }
263
264 const child = appendChild(this, newChild);
265 child.parentElement = null;
266 return child;
267 }
268
269 public insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode {
270 const nodeType = newChild.RRNodeType;

Callers 1

writeMethod · 0.95

Calls 1

appendChildFunction · 0.85

Tested by

no test coverage detected