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

Add an error for invalid children of <ul> #283

Closed
jdufresne opened this issue Jul 21, 2016 · 2 comments
Closed

Add an error for invalid children of <ul> #283

jdufresne opened this issue Jul 21, 2016 · 2 comments

Comments

@jdufresne
Copy link
Contributor

>>> import html5lib
>>> parser = html5lib.HTMLParser()
>>> parser.parseFragment('<ul><ul><li>item</li></ul></ul>')
>>> print(parser.errors)
[]

I would expect an error like: "Element ul not allowed as child of element ul in this context." This is the error reported by W3.org's validator.

The spec states only <li> tags are valid children of <ul>.

@gsnedders
Copy link
Member

We don't implement a validator, and as such we don't implement the content model constraints. The parser only reports parse errors, which are explicitly called out in the Parsing HTML documents section. A quick skim makes it look like that shouldn't produce any parse errors. Implementing an actual validator is a large project to undertake, and really something out of scope here.

@jdufresne
Copy link
Contributor Author

Ah, I see. Thanks for the response.

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

2 participants