mirror of
https://github.com/golang/net.git
synced 2026-03-31 18:37:08 +09:00
html: handle '<' before a tag
As pointed out at https://groups.google.com/forum/#!topic/golang-nuts/LJozHIXAAJY, `<<p>html</p>` was parsed as `<<p>html</p>`. There was no test case for this. Chrome parses it as `<<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
This commit is contained in:
committed by
Nigel Tao
parent
c286e198d6
commit
4109fccea4
@@ -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<0 and y < 0 then x*y>0",
|
||||
},
|
||||
{
|
||||
"not a tag #11",
|
||||
"<<p>",
|
||||
"<$<p>",
|
||||
},
|
||||
// EOF in a tag name.
|
||||
{
|
||||
"tag name eof #0",
|
||||
|
||||
Reference in New Issue
Block a user