1
0
mirror of https://github.com/golang/go synced 2024-11-25 08:47:56 -07:00

html: parse more malformed tags.

This continues the work in revision 914a659b44ff, now passing more test
cases. As before, the new tokenization tests match html5lib's behavior.

Fixes #2124.

R=dsymonds, r
CC=golang-dev
https://golang.org/cl/4867042
This commit is contained in:
Nigel Tao 2011-08-11 18:49:09 +10:00
parent 6ca968c791
commit bca65e395e
2 changed files with 12 additions and 2 deletions

View File

@ -429,7 +429,7 @@ loop:
for ; i < z.p1; i++ {
c := z.buf[i]
switch c {
case '<', '>', '"', '\'', '/', '=':
case '>', '/', '=':
break loop
}
switch {

View File

@ -49,14 +49,24 @@ var tokenTests = []tokenTest{
},
{
"malformed tag #1",
`<p </p>`,
`<p <="" p="">`,
},
{
"malformed tag #2",
`<p id=0</p>`,
`<p id="0&lt;/p">`,
},
{
"malformed tag #2",
"malformed tag #3",
`<p id="0</p>`,
`<p id="0&lt;/p&gt;">`,
},
{
"malformed tag #4",
`<p id="0"</p>`,
`<p id="0" <="" p="">`,
},
// Comments.
{
"comment0",