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

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

Issue 5395045: code review 5395045: html: parse </optgroup> and </option> (Closed)
Patch Set: diff -r cb2b19aa807b https://go.googlecode.com/hg/ Created 13 years, 4 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/html/parse_test.go » ('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 "io" 8 "io"
9 "strings" 9 "strings"
10 ) 10 )
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 case "input", "keygen", "textarea": 1238 case "input", "keygen", "textarea":
1239 // TODO. 1239 // TODO.
1240 case "script": 1240 case "script":
1241 // TODO. 1241 // TODO.
1242 default: 1242 default:
1243 // Ignore the token. 1243 // Ignore the token.
1244 } 1244 }
1245 case EndTagToken: 1245 case EndTagToken:
1246 switch p.tok.Data { 1246 switch p.tok.Data {
1247 case "option": 1247 case "option":
1248 » » » // TODO. 1248 » » » if p.top().Data == "option" {
1249 » » » » p.oe.pop()
1250 » » » }
1249 case "optgroup": 1251 case "optgroup":
1250 » » » // TODO. 1252 » » » i := len(p.oe) - 1
1253 » » » if p.oe[i].Data == "option" {
1254 » » » » i--
1255 » » » }
1256 » » » if p.oe[i].Data == "optgroup" {
1257 » » » » p.oe = p.oe[:i]
1258 » » » }
1251 case "select": 1259 case "select":
1252 endSelect = true 1260 endSelect = true
1253 default: 1261 default:
1254 // Ignore the token. 1262 // Ignore the token.
1255 } 1263 }
1256 case CommentToken: 1264 case CommentToken:
1257 p.doc.Add(&Node{ 1265 p.doc.Add(&Node{
1258 Type: CommentNode, 1266 Type: CommentNode,
1259 Data: p.tok.Data, 1267 Data: p.tok.Data,
1260 }) 1268 })
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 consumed = p.im(p) 1450 consumed = p.im(p)
1443 } 1451 }
1444 // Loop until the final token (the ErrorToken signifying EOF) is consume d. 1452 // Loop until the final token (the ErrorToken signifying EOF) is consume d.
1445 for { 1453 for {
1446 if consumed = p.im(p); consumed { 1454 if consumed = p.im(p); consumed {
1447 break 1455 break
1448 } 1456 }
1449 } 1457 }
1450 return p.doc, nil 1458 return p.doc, nil
1451 } 1459 }
OLDNEW
« no previous file with comments | « no previous file | src/pkg/html/parse_test.go » ('j') | no next file with comments »

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