Elhebert / laravel-sri

Subresource Integrity hash generator for laravel
MIT License
40 stars 16 forks source link

fix: add closing tag to "script" tag #73

Closed owenvoke closed 3 years ago

owenvoke commented 3 years ago

I had a weird issue where in my production app, the JavaScript wasn't working. Spent ages debugging and apparently <script> elements should always have a closing tag, rather than auto-closing. And applying this change seemed to resolve the issue.

I'm not sure if this is just a regression with Firefox developer edition, although it also seemed to fail in Chrome (I'm running on macOS Big Sur), but I'd be interested to know if anyone else experienced this issue.

For reference, I am using HTML 5 DocType (<!DOCTYPE html>), so self-closing tags should in theory be fine. Although according to MDN, both <script> and </script> should always be included. It looks like this is how it was done in v2.x https://github.com/Elhebert/laravel-sri/blob/bc7d65c56a60b4ffbcce9aa7dab1466f3dc6f017/src/Sri.php#L96

owenvoke commented 3 years ago

Thanks! Just a heads up @Elhebert, this should be a v3.0.1 tag rather than v2.5.1. This only affects v3.x

Elhebert commented 3 years ago

🤦‍♂️ Went too fast when creating the release. The last release was a 2.5.0. Will fix that :D

Elhebert commented 3 years ago

Done 👌

owenvoke commented 3 years ago

Cheers!