Skip to content

Commit

Permalink
if xmlns attribute is specified, use that namespace when creating ele…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
JasonCG committed Mar 9, 2024
1 parent 46ebdc8 commit 03354ac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/yew/src/dom_bundle/btag/mod.rs
Expand Up @@ -233,7 +233,14 @@ impl Reconcilable for VTag {
impl VTag {
fn create_element(&self, parent: &Element) -> Element {
let tag = self.tag();


// check for an xmlns attribute. If it exists, create an element with the specified namespace
let xmlns = self.attributes.iter().find(|(k, _)| *k == "xmlns").map(|(_, v)| v);
if let Some(xmlns) = xmlns {
document()
.create_element_ns(Some(xmlns), tag)
.expect("can't create namespaced element for vtag")
} else
if tag == "svg"
|| parent
.namespace_uri()
Expand Down

0 comments on commit 03354ac

Please sign in to comment.