jetti777Ltd / mochiweb

Automatically exported from code.google.com/p/mochiweb
Other
0 stars 0 forks source link

mochiweb_html chokes on a doctype that follows any other tag #52

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
mochiweb_html:parse("<html><!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\"><head></head></body></html>")

What is the expected output? What do you see instead?
Expected output is what you'd get if the doctype was at the beginning:
{<<"html">>,[],[{<<"head">>,[],[]}]}

Instead I get:

exception error: no function clause matching
mochiweb_html:tree([{doctype,[<<"html">>,<<"PUBLIC">>,

<<"-//W3C//DTD HTML 4.01 Transitional//EN">>,

<<"http://www.w3.org/TR/html4/loose.dtd">>]},

{start_tag,<<"head">>,[],false},

{end_tag,<<"head">>},

{end_tag,<<"body">>},

{end_tag <<"html">>}],

[{<<"html">>,[],[]}])

What version of the product are you using? On what operating system?

Latest SVN.

Please provide any additional information below.

Possible patch attached.

Original issue reported on code.google.com by tetrachl...@gmail.com on 16 Dec 2009 at 12:17

Attachments:

GoogleCodeExporter commented 8 years ago
I realize that this is invalid HTML, but I'm running into this situation in the 
wild,
so such stupidity is out there.

Andrew

Original comment by tetrachl...@gmail.com on 16 Dec 2009 at 12:21

GoogleCodeExporter commented 8 years ago
r119

Original comment by bob.ippo...@gmail.com on 2 Jan 2010 at 9:05