@@ -603,10 +603,10 @@ struct EmittingState {
603603
604604#[ derive( Debug ) ]
605605struct ElementState {
606- /// The tag name of the associated HTML element. This is None for the bottom
607- /// item in the stack, or for changes in state that are not associated with
608- /// actual HTML tags.
609- elem : Option < String > ,
606+ /// The associated HTML element. This is None for the bottom item in the
607+ /// stack, or for changes in state that are not associated with actual HTML
608+ /// tags.
609+ elem : Option < html :: Element > ,
610610
611611 /// The origin of this element/state-change.
612612 origin : ElementOrigin ,
@@ -707,7 +707,7 @@ impl EmittingState {
707707 if let Some ( e) = cur. elem . as_ref ( ) {
708708 self . current_content . push ( '<' ) ;
709709 self . current_content . push ( '/' ) ;
710- self . current_content . push_str ( e) ;
710+ self . current_content . push_str ( e. name ( ) ) ;
711711 self . current_content . push ( '>' ) ;
712712 }
713713 }
@@ -728,11 +728,11 @@ impl EmittingState {
728728 }
729729 }
730730
731- fn push_elem < D : std :: fmt :: Display > ( & mut self , name : D , origin : ElementOrigin ) {
731+ fn push_elem ( & mut self , name : & str , origin : ElementOrigin ) {
732732 self . close_automatics ( ) ;
733733
734734 let new_item = ElementState {
735- elem : Some ( name. to_string ( ) ) ,
735+ elem : Some ( name. parse ( ) . unwrap ( ) ) ,
736736 origin,
737737 ..* self . cur_elstate ( )
738738 } ;
@@ -752,11 +752,11 @@ impl EmittingState {
752752 if let Some ( e) = cur. elem . as_ref ( ) {
753753 self . current_content . push ( '<' ) ;
754754 self . current_content . push ( '/' ) ;
755- self . current_content . push_str ( e) ;
755+ self . current_content . push_str ( e. name ( ) ) ;
756756 self . current_content . push ( '>' ) ;
757757 n_closed += 1 ;
758758
759- if e == name {
759+ if e. name ( ) == name {
760760 break ;
761761 }
762762 }
@@ -994,7 +994,7 @@ impl EmittingState {
994994 }
995995
996996 let mut elstate = ElementState {
997- elem : Some ( tagname. to_owned ( ) ) ,
997+ elem : Some ( tagname. parse ( ) . unwrap ( ) ) ,
998998 origin : ElementOrigin :: Manual ,
999999 ..* self . cur_elstate ( )
10001000 } ;
@@ -1398,7 +1398,7 @@ impl EmittingState {
13981398 self . push_space_if_needed ( x0, Some ( fnum) ) ;
13991399 self . current_content . push_str ( "<b>" ) ;
14001400 self . elem_stack . push ( ElementState {
1401- elem : Some ( "b" . to_owned ( ) ) ,
1401+ elem : Some ( html :: Element :: B ) ,
14021402 origin : ElementOrigin :: FontAuto ,
14031403 active_font : af,
14041404 ..* self . cur_elstate ( )
@@ -1409,7 +1409,7 @@ impl EmittingState {
14091409 self . push_space_if_needed ( x0, Some ( fnum) ) ;
14101410 self . current_content . push_str ( "<i>" ) ;
14111411 self . elem_stack . push ( ElementState {
1412- elem : Some ( "i" . to_owned ( ) ) ,
1412+ elem : Some ( html :: Element :: I ) ,
14131413 origin : ElementOrigin :: FontAuto ,
14141414 active_font : af,
14151415 ..* self . cur_elstate ( )
@@ -1430,7 +1430,7 @@ impl EmittingState {
14301430 . unwrap ( ) ;
14311431
14321432 self . elem_stack . push ( ElementState {
1433- elem : Some ( "span" . to_owned ( ) ) ,
1433+ elem : Some ( html :: Element :: Span ) ,
14341434 origin : ElementOrigin :: FontAuto ,
14351435 active_font : desired_af,
14361436 ..* self . cur_elstate ( )
0 commit comments