@@ -138,7 +138,7 @@ impl Vdom {
138 container.set_inner_html("");
138 container.set_inner_html("");
140 // Create a dummy `<div/>` in our container.
140 // Create a dummy `<div/>` in our container.
141− let current_root = Node::element(&dom_buffers[0], "div", [], [], []);
141+ let current_root = Node::element(&dom_buffers[0], "div", [], [], [], None);
142 let current_root = Some(unsafe { extend_node_lifetime(current_root) });
142 let current_root = Some(unsafe { extend_node_lifetime(current_root) });
143 let window = web_sys::window().expect("should have access to the Window");
143 let window = web_sys::window().expect("should have access to the Window");
144 let document = window
144 let document = window
@@ -287,12 +287,12 @@ impl VdomInnerExclusive {
287 self.change_list.emit_set_text(new_text);
287 self.change_list.emit_set_text(new_text);
290− (&Node::Text(TextNode { .. }), Node::Element(ElementNode { .. })) => {
290+ (&Node::Text(_), Node::Element(_)) => {
291 debug!(" replacing a text node with an element");
291 debug!(" replacing a text node with an element");
292 self.create(registry, new);
292 self.create(registry, new);
293 self.change_list.emit_replace_with();
293 self.change_list.emit_replace_with();
295− (&Node::Element(ElementNode { .. }), Node::Text(TextNode { .. })) => {
295+ (&Node::Element(_), Node::Text(_)) => {
296 debug!(" replacing an element with a text node");
296 debug!(" replacing an element with a text node");
297 self.create(registry, new);
297 self.create(registry, new);
298 self.change_list.emit_replace_with();
298 self.change_list.emit_replace_with();
@@ -303,17 +303,19 @@ impl VdomInnerExclusive {
303 listeners: new_listeners,
303 listeners: new_listeners,
304 attributes: new_attributes,
304 attributes: new_attributes,
305 children: new_children,
305 children: new_children,
306+ namespace: new_namespace,
307 Node::Element(ElementNode {
308 Node::Element(ElementNode {
308 tag_name: old_tag_name,
309 tag_name: old_tag_name,
309 listeners: old_listeners,
310 listeners: old_listeners,
310 attributes: old_attributes,
311 attributes: old_attributes,
311 children: old_children,
312 children: old_children,
313+ namespace: old_namespace,
314 debug!(" updating an element");
316 debug!(" updating an element");
315− if new_tag_name != old_tag_name {
317+ if new_tag_name != old_tag_name || new_namespace != old_namespace {
316− debug!(" different tag names; creating new element and replacing old element");
318+ debug!(" different tag names or namespaces; creating new element and replacing old element");
317 self.create(registry, new);
319 self.create(registry, new);
318 self.change_list.emit_replace_with();
320 self.change_list.emit_replace_with();
@@ -462,8 +464,13 @@ impl VdomInnerExclusive {
462 listeners,
464 listeners,
463 attributes,
465 attributes,
464 children,
466 children,
469+ if let Some(namespace) = namespace {
470+ self.change_list.emit_create_element_ns(tag_name, namespace);
466− self.change_list.emit_create_element(tag_name);
472+ self.change_list.emit_create_element(tag_name);
467 for l in listeners {
474 for l in listeners {
469 registry.add(l);
476 registry.add(l);
@@ -471,7 +478,12 @@ impl VdomInnerExclusive {
471 self.change_list.emit_new_event_listener(l);
478 self.change_list.emit_new_event_listener(l);
473 for attr in attributes {
480 for attr in attributes {
481+ if namespace.is_none() || attr.name.starts_with("xmlns") {
474− self.change_list.emit_set_attribute(&attr.name, &attr.value);
482+ self.change_list.emit_set_attribute(&attr.name, &attr.value);
485+ .emit_set_attribute_ns(&attr.name, &attr.value);
476 for child in children {
488 for child in children {
477 self.create(registry, child.clone());
489 self.create(registry, child.clone());