mirror of
https://github.com/golang/go
synced 2024-11-22 08:54:39 -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:
parent
6ca968c791
commit
bca65e395e
@ -429,7 +429,7 @@ loop:
|
|||||||
for ; i < z.p1; i++ {
|
for ; i < z.p1; i++ {
|
||||||
c := z.buf[i]
|
c := z.buf[i]
|
||||||
switch c {
|
switch c {
|
||||||
case '<', '>', '"', '\'', '/', '=':
|
case '>', '/', '=':
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
|
@ -49,14 +49,24 @@ var tokenTests = []tokenTest{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"malformed tag #1",
|
"malformed tag #1",
|
||||||
|
`<p </p>`,
|
||||||
|
`<p <="" p="">`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"malformed tag #2",
|
||||||
`<p id=0</p>`,
|
`<p id=0</p>`,
|
||||||
`<p id="0</p">`,
|
`<p id="0</p">`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"malformed tag #2",
|
"malformed tag #3",
|
||||||
`<p id="0</p>`,
|
`<p id="0</p>`,
|
||||||
`<p id="0</p>">`,
|
`<p id="0</p>">`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"malformed tag #4",
|
||||||
|
`<p id="0"</p>`,
|
||||||
|
`<p id="0" <="" p="">`,
|
||||||
|
},
|
||||||
// Comments.
|
// Comments.
|
||||||
{
|
{
|
||||||
"comment0",
|
"comment0",
|
||||||
|
Loading…
Reference in New Issue
Block a user