aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Balholm <andybalholm@gmail.com>2011-11-09 09:43:55 +1100
committerNigel Tao <nigeltao@golang.org>2011-11-09 09:43:55 +1100
commitce4eec2e0acf9ec36c34bd42e81bbb2e32f18b81 (patch)
tree737e45a20dd5e41a03e1427e60c9d12a7718a0fd
parent3e94e757eff3bfa4150b1e88fda8db98905290de (diff)
downloadgo-ce4eec2e0acf9ec36c34bd42e81bbb2e32f18b81.tar.gz
go-ce4eec2e0acf9ec36c34bd42e81bbb2e32f18b81.zip
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
-rw-r--r--src/pkg/html/parse.go3
-rw-r--r--src/pkg/html/parse_test.go5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go
index c6c96e50e0..f47d4ea147 100644
--- a/src/pkg/html/parse.go
+++ b/src/pkg/html/parse.go
@@ -651,6 +651,9 @@ func inBodyIM(p *parser) (insertionMode, bool) {
}
case "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title":
return useTheRulesFor(p, inBodyIM, inHeadIM)
+ case "image":
+ p.tok.Data = "img"
+ return inBodyIM, false
default:
// TODO.
p.addElement(p.tok.Data, p.tok.Attr)
diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go
index 1f4ffa9564..27979225b3 100644
--- a/src/pkg/html/parse_test.go
+++ b/src/pkg/html/parse_test.go
@@ -133,7 +133,7 @@ func TestParser(t *testing.T) {
n int
}{
// TODO(nigeltao): Process all the test cases from all the .dat files.
- {"tests1.dat", 89},
+ {"tests1.dat", 92},
{"tests2.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
// 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,
- // 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><table><a></table><p><a><div><a>`: true,
}