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

parse html start with comment #19

Open
kxjhcs opened this issue May 31, 2016 · 1 comment
Open

parse html start with comment #19

kxjhcs opened this issue May 31, 2016 · 1 comment

Comments

@kxjhcs
Copy link

kxjhcs commented May 31, 2016

when i run this:
var html = '<!--comment --><html><body><head></head></body></html>' var tree = gumbo(html);

tree.root.nodeType is 8,is it right?

@karlwestin
Copy link
Owner

karlwestin commented Jul 29, 2016

I'm sorry i have completely missed your issue, this is quite interesting actually!
The W3C spec says

The root element of a Document object is that Document's first element child, if any. If it does not have one then the Document has no root element.

This seems to me that a document can have more than 1 root element, and that the comment is root because it's the first child of document.

From the WhatWG spec i can't find that it would be either right or wrong.

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