html: use strings.EqualFold instead of lowering ourselves · golang/net@8e66b04 (original) (raw)

3 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ func parseDoctype(s string) (n *Node, quirks bool) {
87 87 }
88 88 }
89 89 if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" &&
90 -strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" {
90 +strings.EqualFold(lastAttr.Val, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
91 91 quirks = true
92 92 }
93 93 }
Original file line number Diff line number Diff line change
@@ -40,8 +40,7 @@ func htmlIntegrationPoint(n *Node) bool {
40 40 if n.Data == "annotation-xml" {
41 41 for _, a := range n.Attr {
42 42 if a.Key == "encoding" {
43 -val := strings.ToLower(a.Val)
44 -if val == "text/html" |
43 +if strings.EqualFold(a.Val, "text/html") |
45 44 return true
46 45 }
47 46 }
Original file line number Diff line number Diff line change
@@ -1035,7 +1035,7 @@ func inBodyIM(p *parser) bool {
1035 1035 if p.tok.DataAtom == a.Input {
1036 1036 for _, t := range p.tok.Attr {
1037 1037 if t.Key == "type" {
1038 -if strings.ToLower(t.Val) == "hidden" {
1038 +if strings.EqualFold(t.Val, "hidden") {
1039 1039 // Skip setting framesetOK = false
1040 1040 return true
1041 1041 }
@@ -1463,7 +1463,7 @@ func inTableIM(p *parser) bool {
1463 1463 return inHeadIM(p)
1464 1464 case a.Input:
1465 1465 for _, t := range p.tok.Attr {
1466 -if t.Key == "type" && strings.ToLower(t.Val) == "hidden" {
1466 +if t.Key == "type" && strings.EqualFold(t.Val, "hidden") {
1467 1467 p.addElement()
1468 1468 p.oe.pop()
1469 1469 return true