Open weberc2 opened 2 years ago
As documented, those are incorrect uses of HTML
(requires an entire html fragment) and HTMLAttr
(requires the entire key=value pair): https://go.dev/play/p/XmBsJ_itlER
Not sure about URL
.
cc @empijei
@seankhliao Thanks for the response. The docs specify "an HTML document fragment", but "fragment" isn't clearly defined (so perhaps the documentation could be updated to be more explicit about what constitutes a fragment?). For example, from the documentation alone (I'm not sure if "fragment" is taken from the HTML spec or if Go expects users to be familiar with the spec), any of the following could be reasonably understood as fragments:
"bar"
foo="bar"
<p>
<p></p>
Documentation aside, I think you're right that URL seems like the relevant type.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Playground
What did you expect to see?
I expect that data of type
HTML
,URL
, orHTMLAttr
is not escaped inside of an attribute.What did you see instead?
Attributes are always escaped irrespective of data type.