Skip to content

latest version xml comment is not ending as expecting #1823

@yuagonc

Description

@yuagonc

for example

var content = ` <root><node>start</node><!--><node>should ignore</node><--><node>end</node></root> `
var result = htmlparser2.parseDocument(content, {xmlMode: true})

I get six children. And have the child <node>should ignore</node> and <-->.

According to xml format, comment is starting by <!-- and ending with -->
If save this as xml file and open with browser, the comment is recognized by the browser correctly.
I think <!--> should just be recognized as start, not as end at the same time.

I try to use version 5.0.1 which is used by astexplorer and use function parseDOM. Result is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions