createElementNs method

void createElementNs(
  1. CompileElement parent,
  2. NodeReference elementRef,
  3. int nodeIndex,
  4. String? ns,
  5. String tagName,
  6. TemplateAst ast,
)

Creates an html node with a namespace and appends to parent element.

Implementation

void createElementNs(CompileElement parent, NodeReference elementRef,
    int nodeIndex, String? ns, String tagName, TemplateAst ast) {
  if (docVarName == null) {
    _createMethod.addStmt(_createLocalDocumentVar());
  }
  var createRenderNodeExpr = o
      .variable(docVarName)
      .callMethod('createElementNS', [o.literal(ns), o.literal(tagName)]);
  _initializeAndAppendNode(parent, elementRef, createRenderNodeExpr);
}