function insertChildAt(parentNode, childNode, index) {
  // By exploiting arrays returning `undefined` for an undefined index, we can
  // rely exclusively on `insertBefore(node, null)` instead of also using
  // `appendChild(node)`. However, using `undefined` is not allowed by all
  // browsers so we must replace it with `null`.
  parentNode.insertBefore(
    childNode,
    parentNode.childNodes[index] || null
  );
}
Updates a component's children by processing a series of updates. The
update configurations are each expected to have a `parentNode` property.

@param {array<object>} updates List of update configurations.
@param {array<string>} markupList List of markup strings.
@internal