mirror of
https://github.com/golang/go
synced 2024-11-22 04:14:42 -07:00
html: don't emit text token for empty raw text elements.
Pass tests1.dat, test 99: <script></script></div><title></title><p><p> | <html> | <head> | <script> | <title> | <body> | <p> | <p> Also pass tests through test 105: <ul><li><ul></li><li>a</li></ul></li></ul> R=nigeltao CC=golang-dev https://golang.org/cl/5373043
This commit is contained in:
parent
23ffbe611d
commit
ddc5ec642d
@ -133,7 +133,7 @@ func TestParser(t *testing.T) {
|
|||||||
n int
|
n int
|
||||||
}{
|
}{
|
||||||
// TODO(nigeltao): Process all the test cases from all the .dat files.
|
// TODO(nigeltao): Process all the test cases from all the .dat files.
|
||||||
{"tests1.dat", 99},
|
{"tests1.dat", 106},
|
||||||
{"tests2.dat", 0},
|
{"tests2.dat", 0},
|
||||||
{"tests3.dat", 0},
|
{"tests3.dat", 0},
|
||||||
}
|
}
|
||||||
@ -213,4 +213,5 @@ var renderTestBlacklist = map[string]bool{
|
|||||||
// More cases of <a> being reparented:
|
// More cases of <a> being reparented:
|
||||||
`<a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe`: true,
|
`<a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe`: true,
|
||||||
`<a><table><a></table><p><a><div><a>`: true,
|
`<a><table><a></table><p><a><div><a>`: true,
|
||||||
|
`<a><table><td><a><table></table><a></tr><a></table><a>`: true,
|
||||||
}
|
}
|
||||||
|
@ -552,9 +552,11 @@ func (z *Tokenizer) Next() TokenType {
|
|||||||
z.data.end = z.raw.end
|
z.data.end = z.raw.end
|
||||||
if z.rawTag != "" {
|
if z.rawTag != "" {
|
||||||
z.readRawOrRCDATA()
|
z.readRawOrRCDATA()
|
||||||
|
if z.data.end > z.data.start {
|
||||||
z.tt = TextToken
|
z.tt = TextToken
|
||||||
return z.tt
|
return z.tt
|
||||||
}
|
}
|
||||||
|
}
|
||||||
z.textIsRaw = false
|
z.textIsRaw = false
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
|
Loading…
Reference in New Issue
Block a user