Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Generating tree structures for HTML with a comment inside a heading or paragraph fails. #2178

Open
hansjovis opened this issue Mar 1, 2019 · 0 comments
Labels
bug component: parse tree innovation Innovative issue. Relating to performance, memory or data-flow.

Comments

@hansjovis
Copy link
Contributor

hansjovis commented Mar 1, 2019

Generating the tree structure fails for HTML that has a comment within a header or paragraph:

<h1>Hello World!<!-- How are you? --></h1>

The comment gets added to the header as a formatting element, as it should be, but something goes wrong when converting the comment from an Ignored node to a FormattingElement.

It currently errors on the calculation of the start- and end position of the formatting elements.
Specifically on this line, where it fails to get the start tag.

const startTag = element.location.startTag;

More importantly, parse5 recognizes How are you? in the example below as a comment:

<h1>Hello World!</ How are you?
@hansjovis hansjovis changed the title Generating tree structures for HTML with no valid closing tag fails. Generating tree structures for HTML with a comment inside a heading or paragraph fails. Mar 1, 2019
@atimmer atimmer added the innovation Innovative issue. Relating to performance, memory or data-flow. label Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug component: parse tree innovation Innovative issue. Relating to performance, memory or data-flow.
Projects
None yet
Development

No branches or pull requests

2 participants