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

html: treat <image> as <img>

Pass tests1.dat, test 90:
<p><image></p>

| <html>
|   <head>
|   <body>
|     <p>
|       <img>

Also pass test 91:
<a><table><a></table><p><a><div><a>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5339052
This commit is contained in:
Andrew Balholm 2011-11-09 09:43:55 +11:00 committed by Nigel Tao
parent 3e94e757ef
commit ce4eec2e0a
2 changed files with 6 additions and 2 deletions

View File

@ -651,6 +651,9 @@ func inBodyIM(p *parser) (insertionMode, bool) {
} }
case "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title": case "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title":
return useTheRulesFor(p, inBodyIM, inHeadIM) return useTheRulesFor(p, inBodyIM, inHeadIM)
case "image":
p.tok.Data = "img"
return inBodyIM, false
default: default:
// TODO. // TODO.
p.addElement(p.tok.Data, p.tok.Attr) p.addElement(p.tok.Data, p.tok.Attr)

View File

@ -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", 89}, {"tests1.dat", 92},
{"tests2.dat", 0}, {"tests2.dat", 0},
{"tests3.dat", 0}, {"tests3.dat", 0},
} }
@ -210,6 +210,7 @@ var renderTestBlacklist = map[string]bool{
// The second <a> will be reparented to the first <table>'s parent. This // The second <a> will be reparented to the first <table>'s parent. This
// results in an <a> whose parent is an <a>, which is not 'well-formed'. // results in an <a> whose parent is an <a>, which is not 'well-formed'.
`<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y`: true, `<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y`: true,
// The second <a> will be reparented, similar to the case above. // 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,
} }