Commit 22e918f5 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

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

Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454124
parent e4a50195
...@@ -42,6 +42,8 @@ type parser struct { ...@@ -42,6 +42,8 @@ type parser struct {
fosterParenting bool fosterParenting bool
// quirks is whether the parser is operating in "quirks mode." // quirks is whether the parser is operating in "quirks mode."
quirks bool quirks bool
// fragment is whether the parser is parsing an HTML fragment.
fragment bool
// context is the context element when parsing an HTML fragment // context is the context element when parsing an HTML fragment
// (section 12.4). // (section 12.4).
context *Node context *Node
...@@ -1692,7 +1694,9 @@ func afterBodyIM(p *parser) bool { ...@@ -1692,7 +1694,9 @@ func afterBodyIM(p *parser) bool {
} }
case EndTagToken: case EndTagToken:
if p.tok.DataAtom == a.Html { if p.tok.DataAtom == a.Html {
p.im = afterAfterBodyIM if !p.fragment {
p.im = afterAfterBodyIM
}
return true return true
} }
case CommentToken: case CommentToken:
...@@ -2054,6 +2058,7 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) { ...@@ -2054,6 +2058,7 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) {
Type: DocumentNode, Type: DocumentNode,
}, },
scripting: true, scripting: true,
fragment: true,
context: context, context: context,
} }
......
...@@ -80,6 +80,6 @@ PASS "</select><option>" ...@@ -80,6 +80,6 @@ PASS "</select><option>"
PASS "<input><option>" PASS "<input><option>"
PASS "<keygen><option>" PASS "<keygen><option>"
PASS "<textarea><option>" PASS "<textarea><option>"
FAIL "</html><!--abc-->" PASS "</html><!--abc-->"
PASS "</frameset><frame>" PASS "</frameset><frame>"
PASS "" PASS ""
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