1
0
mirror of https://github.com/golang/go synced 2024-11-22 06:54:39 -07:00

html: don't run "adoption agency" on elements that aren't in scope.

Pass tests1.dat, test 55:
<!DOCTYPE html><font><table></font></table></font>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <font>
|       <table>

Also pass tests through test 69:
<DIV> abc <B> def <I> ghi <P> jkl

R=nigeltao
CC=golang-dev
https://golang.org/cl/5309074
This commit is contained in:
Andrew Balholm 2011-10-28 16:04:58 +11:00 committed by Nigel Tao
parent 0e81e508be
commit 03f163c7f2
2 changed files with 5 additions and 1 deletions

View File

@ -675,6 +675,10 @@ func (p *parser) inBodyEndTagFormatting(tag string) {
p.afe.remove(formattingElement) p.afe.remove(formattingElement)
return return
} }
if !p.elementInScope(defaultScopeStopTags, tag) {
// Ignore the tag.
return
}
// Steps 5-6. Find the furthest block. // Steps 5-6. Find the furthest block.
var furthestBlock *Node var furthestBlock *Node

View File

@ -132,7 +132,7 @@ func TestParser(t *testing.T) {
rc := make(chan io.Reader) rc := make(chan io.Reader)
go readDat(filename, rc) go readDat(filename, rc)
// TODO(nigeltao): Process all test cases, not just a subset. // 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. // Parse the #data section.
b, err := ioutil.ReadAll(<-rc) b, err := ioutil.ReadAll(<-rc)
if err != nil { if err != nil {