Fix #3356 js not properly included

Fixes issue that could result in a script tags being placed inside a html comment.