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

exp/html: ignore </html> in afterBodyIM when parsing a fragment

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454124
This commit is contained in:
Andrew Balholm 2012-08-09 10:19:25 +10:00 committed by Nigel Tao
parent e4a50195c3
commit 22e918f5d6
2 changed files with 7 additions and 2 deletions

View File

@ -42,6 +42,8 @@ type parser struct {
fosterParenting bool
// quirks is whether the parser is operating in "quirks mode."
quirks bool
// fragment is whether the parser is parsing an HTML fragment.
fragment bool
// context is the context element when parsing an HTML fragment
// (section 12.4).
context *Node
@ -1692,7 +1694,9 @@ func afterBodyIM(p *parser) bool {
}
case EndTagToken:
if p.tok.DataAtom == a.Html {
p.im = afterAfterBodyIM
if !p.fragment {
p.im = afterAfterBodyIM
}
return true
}
case CommentToken:
@ -2054,6 +2058,7 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
Type: DocumentNode,
},
scripting: true,
fragment: true,
context: context,
}

View File

@ -80,6 +80,6 @@ PASS "</select><option>"
PASS "<input><option>"
PASS "<keygen><option>"
PASS "<textarea><option>"
FAIL "</html><!--abc-->"
PASS "</html><!--abc-->"
PASS "</frameset><frame>"
PASS ""