parseReplacedElement function
Implementation
ReplacedElement parseReplacedElement(
dom.Element element,
List<StyledElement> children,
NavigationDelegate? navigationDelegateForIframe,
) {
switch (element.localName) {
case "br":
return TextContentElement(
text: "\n",
style: Style(whiteSpace: WhiteSpace.PRE),
element: element,
node: element
);
case "iframe":
return IframeContentElement(
name: "iframe",
src: element.attributes['src'],
width: double.tryParse(element.attributes['width'] ?? ""),
height: double.tryParse(element.attributes['height'] ?? ""),
navigationDelegate: navigationDelegateForIframe,
node: element,
);
case "img":
return ImageContentElement(
name: "img",
src: element.attributes['src'],
alt: element.attributes['alt'],
node: element,
);
case "svg":
return SvgContentElement(
name: "svg",
data: element.outerHtml,
width: double.tryParse(element.attributes['width'] ?? ""),
height: double.tryParse(element.attributes['height'] ?? ""),
node: element,
);
case "ruby":
return RubyElement(
element: element,
children: children,
);
default:
return EmptyContentElement(name: element.localName == null ? "[[No Name]]" : element.localName!);
}
}