aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/html/parse.go
diff options
context:
space:
mode:
authorAndrew Balholm <andybalholm@gmail.com>2011-11-04 15:48:11 +1100
committerNigel Tao <nigeltao@golang.org>2011-11-04 15:48:11 +1100
commit632a2c59b12b525edac2fffa4ddd57b3de068707 (patch)
treecc2f865d2031ed512ce64a0a14063e16616f88df /src/pkg/html/parse.go
parent0865c57f252f8c192526833b9de07446477b19f1 (diff)
downloadgo-632a2c59b12b525edac2fffa4ddd57b3de068707.tar.xz
html: properly close <tr> element when an new <tr> starts.
Pass tests1.dat, test 87: <table><tr><tr><td><td><span><th><span>X</table> | <html> | <head> | <body> | <table> | <tbody> | <tr> | <tr> | <td> | <td> | <span> | <th> | <span> | "X" R=nigeltao CC=golang-dev https://golang.org/cl/5343041
Diffstat (limited to 'src/pkg/html/parse.go')
-rw-r--r--src/pkg/html/parse.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go
index 0204b7c281..811e265473 100644
--- a/src/pkg/html/parse.go
+++ b/src/pkg/html/parse.go
@@ -943,22 +943,27 @@ func inRowIM(p *parser) (insertionMode, bool) {
case StartTagToken:
switch p.tok.Data {
case "td", "th":
- // TODO: clear the stack back to a table row context.
+ p.clearStackToContext(tableRowContextStopTags)
p.addElement(p.tok.Data, p.tok.Attr)
p.afe = append(p.afe, &scopeMarker)
return inCellIM, true
+ case "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr":
+ if p.popUntil(tableScopeStopTags, "tr") {
+ return inTableBodyIM, false
+ }
+ // Ignore the token.
+ return inRowIM, true
default:
// TODO.
}
case EndTagToken:
switch p.tok.Data {
case "tr":
- if !p.elementInScope(tableScopeStopTags, "tr") {
- return inRowIM, true
+ if p.popUntil(tableScopeStopTags, "tr") {
+ return inTableBodyIM, true
}
- p.clearStackToContext(tableRowContextStopTags)
- p.oe.pop()
- return inTableBodyIM, true
+ // Ignore the token.
+ return inRowIM, true
case "table":
if p.popUntil(tableScopeStopTags, "tr") {
return inTableBodyIM, false