1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
pub mod renderer;
pub mod figures;
pub mod color;
const SVG_NS: &str = "http://www.w3.org/2000/svg";
pub fn get_document() -> web_sys::Document {
let window = web_sys::window().expect("No window exists");
window.document().expect("The windows should contains a document")
}
pub fn create_element(local_name: &str) -> web_sys::Element {
get_document()
.create_element(local_name)
.expect("Could not create new element")
}
pub fn create_element_ns(namespace: &str, name: &str) -> web_sys::Element {
get_document()
.create_element_ns(Some(namespace), name)
.expect("Could not create new namespaced element")
}