Removes a node and places its children in its place.  If the node
has no parent, the operation is impossible and no action takes place.
function removeNodeSaveChildren(node) {
  // We can't save the children if there's no parent node to provide
  // for them.
  var fosterParent = node.parentNode;
  if (!fosterParent) {
    return;
  }
  var children = (node.childNodes || []).slice();
  for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
    var child = children_1[_i];
    insertBefore(node.parentNode, node, child);
  }
  remove(node);
}