Commit 5530a426 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

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
parent 0bfa31e9
......@@ -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.
......
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>"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment