]> Cypherpunks repositories - gostls13.git/commitdiff
exp/html: ignore </html> in afterBodyIM when parsing a fragment
authorAndrew Balholm <andybalholm@gmail.com>
Thu, 9 Aug 2012 00:19:25 +0000 (10:19 +1000)
committerNigel Tao <nigeltao@golang.org>
Thu, 9 Aug 2012 00:19:25 +0000 (10:19 +1000)
Pass 1 additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6454124

src/pkg/exp/html/parse.go
src/pkg/exp/html/testlogs/tests_innerHTML_1.dat.log

index 03c007e1cd6771173e9a397fdfe3e15e0584153b..0ae660c83dee47adaf54aac0458e8bb5eda7d3d1 100644 (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,
        }
 
index d3df267de9bb25933c9c646f4c03015225b42984..392483ce7931f1c63e377d2569f77326b90c07d2 100644 (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 ""