Function sauron::prelude::html::html_element

source ·
pub fn html_element<MSG>(
    namespace: Option<&'static str>,
    tag: &'static str,
    attrs: impl IntoIterator<Item = Attribute<MSG>>,
    children: impl IntoIterator<Item = Node<MSG>>,
    self_closing: bool
) -> Node<MSG>
Expand description

Creates an html element with the element tag name and namespace This is specifically used for creating svg element where a namespace is needed, otherwise the browser will not render it correctly.

§Examples

use sauron::{*,html::html_element};

let html:Node<()> =
    html_element(Some("http://www.w3.org/2000/svg"),"svg", vec![width(200), height(200), xmlns("http://www.w3.org/2000/svg")], vec![], false);
assert_eq!(node!{<svg width=200 height=200 xmlns="http://www.w3.org/2000/svg"></svg>}, html);