appendChild method

  1. @mustCallSuper
Node appendChild(
  1. Node child
)

Implementation

@mustCallSuper
Node appendChild(Node child) {
  child._ensureOrphan();
  child.parentNode = this;
  childNodes.add(child);

  // To insert a node into a parent before a child, run step 9 from the spec:
  // 9. Run the children changed steps for parent when inserting a node into a parent.
  // https://dom.spec.whatwg.org/#concept-node-insert
  childrenChanged();

  if (child.isConnected) {
    child.connectedCallback();
  }

  return child;
}