From 9ee9ec14cb28a82ef5531c4fdcf1e5b119e160e0 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Sat, 19 Apr 2014 01:10:32 +0200 Subject: [PATCH] Lexer: only pop elements when needed. --- lib/oga/xml/lexer.rl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/oga/xml/lexer.rl b/lib/oga/xml/lexer.rl index 3f08282..31a1465 100644 --- a/lib/oga/xml/lexer.rl +++ b/lib/oga/xml/lexer.rl @@ -477,7 +477,7 @@ module Oga add_token(:T_ELEM_NS, ns) end - @elements << name if html + @elements << name if html? add_token(:T_ELEM_NAME, name) @@ -532,14 +532,14 @@ module Oga emit_buffer add_token(:T_ELEM_END, nil) - @elements.pop + @elements.pop if html? }; # Self closing elements that are not handled by the HTML mode. '/>' => { add_token(:T_ELEM_END, nil) - @elements.pop + @elements.pop if html? }; # Note that this rule should be declared at the very bottom as it