From: Andrew Balholm Date: Fri, 28 Oct 2011 05:04:58 +0000 (+1100) Subject: html: don't run "adoption agency" on elements that aren't in scope. X-Git-Tag: weekly.2011-11-01~28 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=03f163c7f22bfaab69a56d48160b0a184ce6bf54;p=gostls13.git html: don't run "adoption agency" on elements that aren't in scope. Pass tests1.dat, test 55:
| | | | | | Also pass tests through test 69:
abc def ghi

jkl R=nigeltao CC=golang-dev https://golang.org/cl/5309074 --- diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index fdd6f75aab..b0348790c1 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -675,6 +675,10 @@ func (p *parser) inBodyEndTagFormatting(tag string) { p.afe.remove(formattingElement) return } + if !p.elementInScope(defaultScopeStopTags, tag) { + // Ignore the tag. + return + } // Steps 5-6. Find the furthest block. var furthestBlock *Node diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index ae4ecd6658..e86a36f18a 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -132,7 +132,7 @@ func TestParser(t *testing.T) { rc := make(chan io.Reader) go readDat(filename, rc) // TODO(nigeltao): Process all test cases, not just a subset. - for i := 0; i < 55; i++ { + for i := 0; i < 70; i++ { // Parse the #data section. b, err := ioutil.ReadAll(<-rc) if err != nil {