mirror of
https://github.com/golang/go
synced 2024-11-20 09:34:52 -07:00
html: parse <style> elements inside <head> element.
Also correctly handle EOF inside a <style> element. Pass tests1.dat, test 49: <!DOCTYPE html><style> EOF | <!DOCTYPE html> | <html> | <head> | <style> | " EOF" | <body> R=nigeltao CC=golang-dev https://golang.org/cl/5321057
This commit is contained in:
parent
bd07e4f259
commit
833fb4198d
@ -443,7 +443,7 @@ func inHeadIM(p *parser) (insertionMode, bool) {
|
|||||||
switch p.tok.Data {
|
switch p.tok.Data {
|
||||||
case "meta":
|
case "meta":
|
||||||
// TODO.
|
// TODO.
|
||||||
case "script", "title":
|
case "script", "title", "noscript", "noframes", "style":
|
||||||
p.addElement(p.tok.Data, p.tok.Attr)
|
p.addElement(p.tok.Data, p.tok.Attr)
|
||||||
p.setOriginalIM(inHeadIM)
|
p.setOriginalIM(inHeadIM)
|
||||||
return textIM, true
|
return textIM, true
|
||||||
@ -763,6 +763,8 @@ func (p *parser) inBodyEndTagOther(tag string) {
|
|||||||
// Section 11.2.5.4.8.
|
// Section 11.2.5.4.8.
|
||||||
func textIM(p *parser) (insertionMode, bool) {
|
func textIM(p *parser) (insertionMode, bool) {
|
||||||
switch p.tok.Type {
|
switch p.tok.Type {
|
||||||
|
case ErrorToken:
|
||||||
|
p.oe.pop()
|
||||||
case TextToken:
|
case TextToken:
|
||||||
p.addText(p.tok.Data)
|
p.addText(p.tok.Data)
|
||||||
return textIM, true
|
return textIM, true
|
||||||
|
@ -132,7 +132,7 @@ func TestParser(t *testing.T) {
|
|||||||
rc := make(chan io.Reader)
|
rc := make(chan io.Reader)
|
||||||
go readDat(filename, rc)
|
go readDat(filename, rc)
|
||||||
// TODO(nigeltao): Process all test cases, not just a subset.
|
// TODO(nigeltao): Process all test cases, not just a subset.
|
||||||
for i := 0; i < 49; i++ {
|
for i := 0; i < 50; i++ {
|
||||||
// Parse the #data section.
|
// Parse the #data section.
|
||||||
b, err := ioutil.ReadAll(<-rc)
|
b, err := ioutil.ReadAll(<-rc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user