Skip to content

Self closing non void elements validations #590

@TomaszBukowski123

Description

@TomaszBukowski123

Hi,

While parsing one of the error files, I noticed that the messages coming from HtmlDocument.ParseErrors are not very precise. Of course they are somewhat correct but in my opinion insufficient to quickly track down the problem which was the self closing non void element (in my case it was style element). I suggest adding a specific validation for this particular case so as to better follow the html specfication: https://html.spec.whatwg.org/multipage/syntax.html#elements-2 and properly report all self closing elements which are not void elements cited in the link above. I created simple test file which produces such results:

Image

<html>
<head>
<title>Title here</title>
<style type="text/css" />
</head>
<body>
</div>
Some text here
</div>
</body>
</html>

I'm talking about such validation because result produced by HAP (with default options) looks like this:

<html>
<head>
<title>Title here</title>
<style type="text/css"></style></head></html>

and it might be a little hard to understand thos parsing errors if we didn't notice malformed style node in orginal document

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions