function writeDocument(node, features, objectStack) {
  const /** @type {import("../xml.js").NodeStackItem} */ context = {node: node};
  pushSerializeAndPop(
    context,
    DOCUMENT_SERIALIZERS,
    DOCUMENT_NODE_FACTORY,
    features,
    objectStack,
    undefined,
    this,
  );
}
@param {Element} node Node.
@param {Array<Feature>} features Features.
@param {Array<*>} objectStack Object stack.
@this {KML}