Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html/template: matches DOCTYPE in a case-sensitive manner. Should be insensitive. #3094

Closed
gopherbot opened this issue Feb 21, 2012 · 3 comments
Milestone

Comments

@gopherbot
Copy link

by wlott@imbaent.com:

What steps will reproduce the problem?

package main
import (
    "html/template"
    "os"
)
func main() {
    t1,_ := template.New("works").Parse("<!DOCTYPE html><html></html>\n")
    t1.Execute(os.Stdout, nil)
    t2,_ := template.New("fails").Parse("<!doctype html><html></html>\n")
    t2.Execute(os.Stdout, nil)
}


What is the expected output?

<!DOCTYPE html><html></html>
<!doctype html><html></html>

What do you see instead?

<!DOCTYPE html><html></html>
&lt;!doctype html><html></html>

Which compiler are you using (5g, 6g, 8g, gccgo)?

Don't know, whatever "go run" uses internally.

Which operating system are you using?

Windows (x64)

Which revision are you using?  (hg identify)

Prebuilt, downloaded from:
    http://code.google.com/p/gomingw/downloads/detail?name=gowinamd64_weekly.2012-02-14.zip&;can=2&q=

Please provide any additional information below.

Line 577 of src/pkg/html/template/escape.go:
    var doctypeBytes = []byte("<!DOCTYPE")
and line 596:
    if s[j] == '<' && !bytes.HasPrefix(s[j:], doctypeBytes) {
look like they are just checking for fixed bytes without normalizing the case.
    http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#the-doctype
clearly says the check should be case insensitive.
@bytbox
Copy link
Contributor

bytbox commented Feb 21, 2012

Comment 1:

Fixed at CL5687065 (http://golang.org/cl/5687065/). Thanks.

@dsymonds
Copy link
Contributor

Comment 2:

(bytbox)

Labels changed: added priority-go1, removed priority-triage.

Status changed to Started.

@nigeltao
Copy link
Contributor

Comment 3:

This issue was closed by revision c05c3a9.

Status changed to Fixed.

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants