Skip to content

parser.valid accepts malformed input #227

@BadIdeaException

Description

@BadIdeaException

It seems that parser.valid accepts even the most ludicrously malformed input strings as valid HTML:

const { valid } = require('node-html-parser');

var valid = require("node-html-parser").valid;

valid('<p abc</p'); // false
valid('<div<p abc</p></span>'); // false
valid('<div><p abc</p></div>'); // true
valid('<div<p abc</a></div>'); // true
valid('@#><p'); // true
valid('<<>'); // true

Also see here on RunKit

As far as I can see, none of the above should be true.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions