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

Attribute value in form tag becaome lowcase #620

Closed
gyuber opened this issue Oct 27, 2023 · 5 comments
Closed

Attribute value in form tag becaome lowcase #620

gyuber opened this issue Oct 27, 2023 · 5 comments

Comments

@gyuber
Copy link

gyuber commented Oct 27, 2023

Hello~

special attribute are lowcased
example)
https://go.dev/play/p/5Ntxc6sP35r

func main() {
	m := minify.New()
	m.Add("text/html", &html.Minifier{
		KeepQuotes:   true,
		KeepEndTags:  true,
		KeepComments: true,
	})

	m.AddFuncRegexp(regexp.MustCompile("^(application|text)/(x-)?(java|ecma)script$"), js.Minify)

	tag := `<form target="TarGet" method="Method">`
	s, err := m.String("text/html", tag)
	if err != nil {
		panic(err)
	}
	fmt.Println(s)
}

<form target="target" method="method">

expect

<form target="TarGet" method="Method">

Can you help me?

@gyuber gyuber changed the title value int form tag becaome lowcase Value int form tag becaome lowcase Oct 27, 2023
@gyuber gyuber changed the title Value int form tag becaome lowcase Value in form tag becaome lowcase Oct 27, 2023
@gyuber gyuber changed the title Value in form tag becaome lowcase Attribute Value in form tag becaome lowcase Oct 27, 2023
@gyuber gyuber changed the title Attribute Value in form tag becaome lowcase Attribute value in form tag becaome lowcase Oct 27, 2023
@tdewolff
Copy link
Owner

Hi, the attribute value is case-insensitive. It shouldn't matter if it's lowercase. The minifier uses lowercase to improve the optimization by GZIP (after minification).

What is the problem you're having? Is this related to JS?

@gyuber
Copy link
Author

gyuber commented Oct 30, 2023

I know that attribute name is case-insensitive.
but value is no mention

cc w3 : https://www.w3.org/TR/2010/WD-html-markup-20101019/documents.html

@tdewolff
Copy link
Owner

tdewolff commented Oct 30, 2023

Well, the HTML minifier doesn't lowercase values in general, but a specific set of attribute are lowercased according to this list: https://html.spec.whatwg.org/multipage/indices.html#attributes-3

Specifically, method can be any of get,post,dialog (case-insensitive) and target must be a valid navigable name which can be a framename (case-sensitive). I've fixed tha latter case.

@gyuber
Copy link
Author

gyuber commented Oct 31, 2023

Agree .. method can be case-insensitive..
Can I Check to attrmap case-insensitive or case-sensitive ?

@tdewolff
Copy link
Owner

I've disabled attribute value lowercasing, it is causing too many problems for various users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants