Macro dominator::svg

source ·
macro_rules! svg {
    ($($args:tt)+) => { ... };
}
Expand description

Creates an SVG Dom node.

The first argument is the SVG tag, and the second argument is a block of method calls.

Inside of the block you can use DomBuilder methods:

svg!("line", {
    .class("foo")
    .attr("x1", "5")
    .attr_signal("x2", ...)
})

The block uses the apply_methods! macro, see the docs for apply_methods! for more details.

You can also specify the static type of the SVG element:

html!("line" => web_sys::SvgLineElement, {
    ...
})

If you don’t specify a type, it defaults to web_sys::SvgElement.