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

Does not recognize <!DOCTYPE html> as open HTML tag #28

Open
GoogleCodeExporter opened this issue Nov 22, 2015 · 2 comments
Open

Does not recognize <!DOCTYPE html> as open HTML tag #28

GoogleCodeExporter opened this issue Nov 22, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What will reproduce the problem?
Trying to get nodes inside html tags if document uses html5

If 'file.html' starts with the HTML5 tag.
<!DOCTYPE html>
...
</html>

$html_node = $html('html', 0);
echo gettype($html_node);     // RETURNS NULL


However if the doc is declared with

<html>
...
</html>

it works as intended



What is the expected output? What do you see instead?


Which version are you using?


Please provide any additional information below.


Original issue reported on code.google.com by bruc...@gmail.com on 5 Dec 2012 at 8:56

@GoogleCodeExporter
Copy link
Author

Are you sure the first example is valid HTML?

http://www.w3schools.com/tags/tag_doctype.asp
http://dev.w3.org/html5/spec/single-page.html#the-doctype

"The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web 
browser about what version of HTML the page is written in."

Do you want Ganon to try to recover the html node from the closing tag?

Original comment by niels....@gmail.com on 7 Dec 2012 at 5:53

@GoogleCodeExporter
Copy link
Author

Yes, my mistake. It's not an HTML tag per se.
However, it can still be valid. On these validators:

http://validator.w3.org/nu/
http://validator.w3.org/check

The following validates:
<!DOCTYPE html>
<head>
<title></title>
</head>
<body>
</body>
</html> 


So perhaps it would be nice for Ganon to parse "<!DOCTYPE html>" as an opening 
HTML tag nd make it the root node?

Original comment by bruc...@gmail.com on 8 Dec 2012 at 1:52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant