Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected "/floki" tag #50

Open
hauntedhost opened this issue May 23, 2016 · 2 comments
Open

Unexpected "/floki" tag #50

hauntedhost opened this issue May 23, 2016 · 2 comments
Labels
Projects

Comments

@hauntedhost
Copy link

Via #37 it looks like handling unclosed tags is a goal for built-in HTML parser. But I was surprised that a tag name floki was added to the parsed html tree here. Is this expected behavior?

iex> "<div>hello <h1>world</h1><script>alert('wat');</div>" |> Floki.parse
{"div", [],
 ["hello ", {"h1", [], ["world"]},
  {"script", [], ["alert('wat');</div></floki>"]}]}
@philss
Copy link
Owner

philss commented May 24, 2016

@somlor thanks for the report! No, this is not expected. The floki tag is a "hack" to fix a problem with mochiweb_html parser.

The problem is that the parser can't understand very well HTML snippets without a parent tag (for example: <span>Click</span><button>Here</button> will be parsed as {"span", [], ["Click"]}).

The remotion of this closing tag </floki> can fix the problem. But one test is failing.
I'm trying to think a better way to fix this.

@philss philss added the Bug label May 24, 2016
@hauntedhost
Copy link
Author

@philss OK, makes sense. Let me know if there is anything I can do to help.

@philss philss added this to Needs triage in Bugs Jun 7, 2020
@philss philss moved this from Needs triage to Low priority in Bugs Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Bugs
  
Low priority
Development

No branches or pull requests

2 participants