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

exp/html: correctly handle <title> after </head>

The <title> element was getting removed from the stack of open elements,
when its parent, the <head> element should have been removed instead.

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6449101
This commit is contained in:
Andrew Balholm 2012-08-07 13:36:08 +10:00 committed by Nigel Tao
parent 0bfa31e961
commit 5530a426ef
2 changed files with 3 additions and 3 deletions

View File

@ -669,7 +669,7 @@ func afterHeadIM(p *parser) bool {
return true
case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title:
p.oe = append(p.oe, p.head)
defer p.oe.pop()
defer p.oe.remove(p.head)
return inHeadIM(p)
case a.Head:
// Ignore the token.

View File

@ -1,7 +1,7 @@
PASS "<!doctype html><body><title>X</title>"
PASS "<!doctype html><table><title>X</title></table>"
FAIL "<!doctype html><head></head><title>X</title>"
FAIL "<!doctype html></head><title>X</title>"
PASS "<!doctype html><head></head><title>X</title>"
PASS "<!doctype html></head><title>X</title>"
PASS "<!doctype html><table><meta></table>"
PASS "<!doctype html><table>X<tr><td><table> <meta></table></table>"
PASS "<!doctype html><html> <head>"