Hacker News new | ask | show | jobs
by grey-area 3448 days ago
Just had a look at your issue:

https://github.com/golang/go/issues/18569

I think your comment above isn't quite right. The problem you're seeing is that previously this was escaped as js (incorrect), and now it is escaped as text (correct). If you set your type as above to "text/javascript", it works in go 1.8:

<script type="text/javascript"> <div><%= something %></div> </script>

on 1.8 outputs:

<script type="text/javascript"> <div><%= something %></div> </script>

the one that fails is if you set the type to text/template or similar, which makes sense I guess as it is not js but might be annoying if your library uses <> as delimiters. Should work with text/template though if you mark those snippets as template.HTML type before including in an html/template.

1 comments

Thanks for looking! Yeah, I managed to typo the HN example - yes, my existing templates contain type="text/template", and I think that's how I filed the bug. It's possible for me to inject those templates with a variable instead of including them directly in the template, although that's a bit more invasive of a change than what I was doing before.