Search code examples
javascriptjslint

JSLint expected "/" after </script>


The title says it all really. I've written a bit of JS code, it works fine, but I decided to run it through JSLint just to be sure.

There were a few trailing spaces, and a couple of instances of "use spaces, not tabs" which is all fine. However, then there was:

Expected '/' and instead saw ''.        46.12
        </script>

So apparently JSLint expects a trailing / after a closing script tag. I've not heard of this before, and I can't see how anything outside the script tags would/should influence anything within the script tags.

Is there any reason to include a trailing / after any closing tag?

I've used google and SO search, but not found an answer.


Solution

  • The simple reason behind this is that </script> is not part of your actual code (instead it's a directive to your user agent that its contents are code), and therefore shouldn't itself be being run through JSLint.