diff --git a/enterprise-compiler/src/lib.rs b/enterprise-compiler/src/lib.rs index f1bb6df..369a31c 100644 --- a/enterprise-compiler/src/lib.rs +++ b/enterprise-compiler/src/lib.rs @@ -147,7 +147,7 @@ impl Visitor { match node { TaggedRsx::Elem(_, Elem { tag, attrs, inner }) => { self.impl_code.extend(quote! { - fn #make_node_id(&self) -> impl stdweb::web::IElement { + fn #make_node_id(&self) -> impl stdweb::web::INode { let el = document().create_element(#tag).unwrap(); el } @@ -157,7 +157,7 @@ impl Visitor { TaggedRsx::Code(_, expr) => { self.impl_code.extend(quote! { #[inline] - fn #make_node_id(&self) -> impl stdweb::web::IElement { + fn #make_node_id(&self) -> impl stdweb::web::INode { let el = document().create_element("span").expect("shouldn't fail"); el.set_attribute("id", #node_id); el @@ -167,10 +167,12 @@ impl Visitor { TaggedRsx::Text(_, literal) => { self.impl_code.extend(quote! { #[inline] - fn #make_node_id(&self) -> impl stdweb::web::IElement { - let el = document().create_element("span").expect("shouldn't fail"); - el.set_text_content(#literal); - el + fn #make_node_id(&self) -> impl stdweb::web::INode { + use stdweb::unstable::TryFrom; + let string: Value = #literal.into(); + let reference = Reference::try_from(string).unwrap(); + let node = TextNode::try_from(reference).unwrap(); + node } }); } diff --git a/src/main.rs b/src/main.rs index 7511d60..c335f76 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ extern crate stdweb; mod backend; -use stdweb::web::{document, Element, IElement, INode, INonElementParentNode}; +use stdweb::{web::{document, Element, IElement, INode, TextNode, INonElementParentNode}, Reference, Value}; use crate::backend::{Backend, Web};