Commit 03f163c7 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

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
parent 0e81e508
...@@ -675,6 +675,10 @@ func (p *parser) inBodyEndTagFormatting(tag string) { ...@@ -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
......
...@@ -132,7 +132,7 @@ func TestParser(t *testing.T) { ...@@ -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 {
......
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