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

HTML mode throws on mismatched tags #112

Open
dabbler0 opened this issue Jul 23, 2015 · 6 comments
Open

HTML mode throws on mismatched tags #112

dabbler0 opened this issue Jul 23, 2015 · 6 comments

Comments

@dabbler0
Copy link
Member

Parse5 is able to parse the following document:

<b>
  <i>
</b>

But when the HTML mode tries to blockify it it thows Improper parser: block cannot nest immediately inside another block.

@sakagg
Copy link
Contributor

sakagg commented Jul 23, 2015

Seems to be a problem with parse5 location info.
I'll try to fix this in parse5 itself.

@sakagg
Copy link
Contributor

sakagg commented Jul 23, 2015

On further analysis I've found the cause of the problem
The parser isn't parsing it correctly.
I've opened an issue there
inikulin/parse5#57

@davidbau
Copy link
Member

From that issue, it looks like this parse5 behavior is intentional, and I agree, that's what is specified in the HTML5 specification and how browsers actually behave. When tags are misnested, the parser can synthesize extra elements where no explicit tag was given.

This is an interesting case to try to render. We could either
(a) omit showing as blocks any elements that are missing their begin-tag or
(b) try rendering elements-without-a-begin-tag as blocks anyway.

I think (a) might make more sense. If we are in such a situation and there is no begin-tag but there is an end-tag for an element, we might synthesize an "error block" to surround just the end-tag.

@davidbau
Copy link
Member

Another minimal test document that we should untangle:

abc</b>def

When we have an end-tag without a begin-tag we seem to lose track of things. I think we should probably highlight it as an error-tag block.

@sakagg
Copy link
Contributor

sakagg commented Jul 23, 2015

I didn't realize that's how HTML5 spec has it! If its part of the spec, it should be part of this program
Both of them seem to be interesting problems.

@sakagg
Copy link
Contributor

sakagg commented Aug 5, 2015

We can close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants