kostya/lexbor

noscript tag is not parsed correctly

Dan-Do opened this issue · 1 comments

tpl_html = <<-TEMPLATE
<noscript><li class="nav-item"><a class="nav-link btn btn-icon" href="/user/{{this.state.user.key}}" data-lsbt="user_info"><i class="zmdi zmdi-account"></i></a></li></noscript>
TEMPLATE
parser = Lexbor::Parser.new(tpl_html)
walk(parser.body!)
p parser.to_html

The result is:

Lexbor::Node(:body)
  Lexbor::Node(:li, {"class" => "nav-item"})
    Lexbor::Node(:a, {"class" => "nav-link btn btn-icon", "href" => "/user/{{this.state.user.key}}", "data-lsbt" => "user_info"})
      Lexbor::Node(:i, {"class" => "zmdi zmdi-account"})

The html is wrongly parsed

"<html><head><noscript></noscript></head><body><li class="nav-item"><a class="nav-link btn btn-icon" href="/user/{{this.state.user.key}}" data-lsbt="user_info"><i class="zmdi zmdi-account"></i></a></li></body></html>"

Seems by default it parsed to head, if you add <body> at start, it would parse correctly. Myhtml works the same. I think this is default parsing algorithm. You can ask original lib author why. If you open this if firefox, it also would be in header.