Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(43)

Side by Side Diff: src/pkg/exp/html/parse.go

Issue 6450109: code review 6450109: exp/html: ignore self-closing flag except in SVG and MathML (Closed)
Patch Set: diff -r 0934e2afdec9 https://go.googlecode.com/hg/ Created 12 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/pkg/exp/html/testlogs/webkit01.dat.log » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package html 5 package html
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 a "exp/html/atom" 9 a "exp/html/atom"
10 "fmt" 10 "fmt"
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 case a.Math, a.Svg: 992 case a.Math, a.Svg:
993 p.reconstructActiveFormattingElements() 993 p.reconstructActiveFormattingElements()
994 if p.tok.DataAtom == a.Math { 994 if p.tok.DataAtom == a.Math {
995 adjustAttributeNames(p.tok.Attr, mathMLAttribute Adjustments) 995 adjustAttributeNames(p.tok.Attr, mathMLAttribute Adjustments)
996 } else { 996 } else {
997 adjustAttributeNames(p.tok.Attr, svgAttributeAdj ustments) 997 adjustAttributeNames(p.tok.Attr, svgAttributeAdj ustments)
998 } 998 }
999 adjustForeignAttributes(p.tok.Attr) 999 adjustForeignAttributes(p.tok.Attr)
1000 p.addElement() 1000 p.addElement()
1001 p.top().Namespace = p.tok.Data 1001 p.top().Namespace = p.tok.Data
1002 if p.hasSelfClosingToken {
1003 p.oe.pop()
1004 p.acknowledgeSelfClosingTag()
1005 }
1002 return true 1006 return true
1003 case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.T d, a.Tfoot, a.Th, a.Thead, a.Tr: 1007 case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.T d, a.Tfoot, a.Th, a.Thead, a.Tr:
1004 // Ignore the token. 1008 // Ignore the token.
1005 default: 1009 default:
1006 p.reconstructActiveFormattingElements() 1010 p.reconstructActiveFormattingElements()
1007 p.addElement() 1011 p.addElement()
1008 } 1012 }
1009 case EndTagToken: 1013 case EndTagToken:
1010 switch p.tok.DataAtom { 1014 switch p.tok.DataAtom {
1011 case a.Body: 1015 case a.Body:
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 consumed := false 2008 consumed := false
2005 for !consumed { 2009 for !consumed {
2006 if p.inForeignContent() { 2010 if p.inForeignContent() {
2007 consumed = parseForeignContent(p) 2011 consumed = parseForeignContent(p)
2008 } else { 2012 } else {
2009 consumed = p.im(p) 2013 consumed = p.im(p)
2010 } 2014 }
2011 } 2015 }
2012 2016
2013 if p.hasSelfClosingToken { 2017 if p.hasSelfClosingToken {
2018 // This is a parse error, but ignore it.
2014 p.hasSelfClosingToken = false 2019 p.hasSelfClosingToken = false
2015 p.parseImpliedToken(EndTagToken, p.tok.DataAtom, p.tok.Data)
2016 } 2020 }
2017 } 2021 }
2018 2022
2019 func (p *parser) parse() error { 2023 func (p *parser) parse() error {
2020 // Iterate until EOF. Any other error will cause an early return. 2024 // Iterate until EOF. Any other error will cause an early return.
2021 var err error 2025 var err error
2022 for err != io.EOF { 2026 for err != io.EOF {
2023 err = p.read() 2027 err = p.read()
2024 if err != nil && err != io.EOF { 2028 if err != nil && err != io.EOF {
2025 return err 2029 return err
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 parent = root 2108 parent = root
2105 } 2109 }
2106 2110
2107 result := parent.Child 2111 result := parent.Child
2108 parent.Child = nil 2112 parent.Child = nil
2109 for _, n := range result { 2113 for _, n := range result {
2110 n.Parent = nil 2114 n.Parent = nil
2111 } 2115 }
2112 return result, nil 2116 return result, nil
2113 } 2117 }
OLDNEW
« no previous file with comments | « no previous file | src/pkg/exp/html/testlogs/webkit01.dat.log » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b