philss/floki

HTML templates not properly parsed when using Floki.HTMLParser.FastHtml

gbrlmtrz opened this issue · 1 comments

Description

The contents of an html template fail to be included in the resulting parsed structure, thus resulting in an empty template.

To Reproduce

Steps to reproduce the behavior:

  • Using Floki v0.31.0
  • Using Elixir v1.13.0
  • Using Erlang OTP v24
  • With this code:
      a = "<!doctype html><html><head></head><body><template id=\"idc\">I am a text node <p>And I am inside a p tag</p></template></body></html>"
    {:ok, doc} =  Floki.parse_document(a, html_parser: Floki.HTMLParser.FastHtml)
    
    {:ok,                                
     [
       {"html", [],
        [{"head", [], []}, {"body", [], [{"template", [{"id", "idc"}], []}]}]}
     ]}

## Expected behavior

Output should include the contents of the template.

```elixir
  {:ok,                                
   [
     {"html", [],
      [{"head", [], []}, {"body", [], [{"template", [{"id", "idc"}], ["I am a text node ", {"p", [], ["And I am inside a p tag"]}]}]}]}
   ]}

Hey @gbrlmtrz 👋
Thanks for open the issue.

I think this is a problem in FastHTML. Maybe the parser doesn't support templates yet. I will try to confirm this week.