Commit 4109fcce authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

html: handle '<' before a tag

As pointed out at
https://groups.google.com/forum/#!topic/golang-nuts/LJozHIXAAJY,
`<<p>html</p>` was parsed as `&lt;&lt;p&gt;html</p>`.
There was no test case for this. Chrome parses it as `&lt<p>html</p>`,
and that seems to be correct. We were missing the
"Reconcume the current input character" step at
http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tag-open-state

LGTM=nigeltao
R=golang-codereviews, gobot, nigeltao
CC=golang-codereviews, nigeltao
https://golang.org/cl/96060044
parent c286e198
......@@ -1002,6 +1002,8 @@ loop:
// "<!DOCTYPE declarations>" and "<?xml processing instructions?>".
tokenType = CommentToken
default:
// Reconsume the current character.
z.raw.end--
continue
}
......
......@@ -105,6 +105,11 @@ var tokenTests = []tokenTest{
"if x<0 and y < 0 then x*y>0",
"if x&lt;0 and y &lt; 0 then x*y&gt;0",
},
{
"not a tag #11",
"<<p>",
"&lt;$<p>",
},
// EOF in a tag name.
{
"tag name eof #0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment