lexDomTree static method

StyledElement lexDomTree(
  1. Document html,
  2. List<String> customRenderTags,
  3. List<String> tagsList,
  4. NavigationDelegate? navigationDelegateForIframe,
  5. BuildContext context,
)

lexDomTree converts a DOM document to a simplified tree of StyledElements.

Implementation

static StyledElement lexDomTree(
  dom.Document html,
  List<String> customRenderTags,
  List<String> tagsList,
  NavigationDelegate? navigationDelegateForIframe,
  BuildContext context,
) {
  StyledElement tree = StyledElement(
    name: "[Tree Root]",
    children: <StyledElement>[],
    node: html.documentElement,
    style: Style.fromTextStyle(Theme.of(context).textTheme.bodyMedium!),
  );

  html.nodes.forEach((node) {
    tree.children.add(_recursiveLexer(
      node,
      customRenderTags,
      tagsList,
      navigationDelegateForIframe,
    ));
  });

  return tree;
}