From cde011aa5e6b32f6236b133439d2432a1baa9fef Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 5 Sep 2019 11:58:48 +0200 Subject: [PATCH] xhtml: Panic on unknown elements still present after parsing. --- src/xhtml.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xhtml.rs b/src/xhtml.rs index 224e0bb5..1ec6a047 100644 --- a/src/xhtml.rs +++ b/src/xhtml.rs @@ -241,7 +241,7 @@ impl Tag { let style = write_attr(get_style_string(style), "style"); format!("{}", style, children_to_html(children)) } - Tag::Unknown(children) => children_to_html(children), + Tag::Unknown(children) => panic!("No unknown element should be present in XHTML-IM after parsing."), } } } @@ -334,7 +334,7 @@ impl From for Element { Some(style) => vec![("style", style)], None => vec![], }, children), - Tag::Unknown(children) => return Element::builder("unknown").ns(ns::XHTML).append(children_to_nodes(children)).build(), + Tag::Unknown(children) => panic!("No unknown element should be present in XHTML-IM after parsing."), }; let mut builder = Element::builder(name) .ns(ns::XHTML)