From 5530a426efed5baa88e47ac73be19d7b7e99d743 Mon Sep 17 00:00:00 2001 From: Andrew Balholm Date: Tue, 7 Aug 2012 13:36:08 +1000 Subject: [PATCH] exp/html: correctly handle 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 --- src/pkg/exp/html/parse.go | 2 +- src/pkg/exp/html/testlogs/tests7.dat.log | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pkg/exp/html/parse.go b/src/pkg/exp/html/parse.go index 6b1f40cb8ea..0bde2fe0e72 100644 --- a/src/pkg/exp/html/parse.go +++ b/src/pkg/exp/html/parse.go @@ -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. diff --git a/src/pkg/exp/html/testlogs/tests7.dat.log b/src/pkg/exp/html/testlogs/tests7.dat.log index 85d6c77088c..dfb956b01f9 100644 --- a/src/pkg/exp/html/testlogs/tests7.dat.log +++ b/src/pkg/exp/html/testlogs/tests7.dat.log @@ -1,7 +1,7 @@ PASS "<!doctype html><body><title>X" PASS "X
" -FAIL "X" -FAIL "X" +PASS "X" +PASS "X" PASS "
" PASS "X
" PASS " "