function createElementHelper(tagName, opt_bag) {
    // Allow passing in ownerDocument to create in a different document.
    let doc;
    if (opt_bag && opt_bag.ownerDocument) doc = opt_bag.ownerDocument;
    else doc = cr.doc;
    return doc.createElement(tagName);
  }
Helper function for creating new element for define.