generateFromHTML method

T? generateFromHTML(
  1. String htmlRoot, {
  2. DOMTreeMap<T>? treeMap,
  3. DOMElement? domParent,
  4. T? parent,
  5. DOMContext<T>? context,
  6. bool finalizeTree = true,
  7. bool setTreeMapRoot = true,
})

Same as generate, but parses htmlRoot first.

Implementation

T? generateFromHTML(String htmlRoot,
    {DOMTreeMap<T>? treeMap,
    DOMElement? domParent,
    T? parent,
    DOMContext<T>? context,
    bool finalizeTree = true,
    bool setTreeMapRoot = true}) {
  var root = $htmlRoot(htmlRoot,
      defaultTagDisplayInlineBlock: false,
      defaultRootTag: parent != null ? 'dom-builder-html-root' : null);

  if (root == null) return null;

  if (root.tag == 'dom-builder-html-root') {
    var rootParent = parent != null ? getNodeParent(parent) : null;

    return generateWithRoot(domParent, parent, root.content!,
        treeMap: treeMap,
        rootParent: rootParent,
        context: context,
        finalizeTree: finalizeTree,
        setTreeMapRoot: setTreeMapRoot);
  } else {
    return generate(root,
        treeMap: treeMap,
        parent: parent,
        context: context,
        finalizeTree: finalizeTree,
        setTreeMapRoot: setTreeMapRoot);
  }
}