I'm discussing an error my coworker received on our staging environment with a few other developers. Basically what they have deduced is this:
We have a <script>
at the top of the <body>
that is commented out:
<!-- <script src="some-file.js"></script>-->
And a third-party script is being injected into the document. This script looks like this:
<!-- Begin Vendor Code -->
<script src=".."></script>
<script src=".."></script>
<!-- End Vendor Code -->
What it looks like has happened is that the vendor code has been injected after the opening comment of the <script>
tag that is already commented out:
<!--<!-- Begin Vendor Code -->
<script src=".."></script>
<script src=".."></script>
<!-- End Vendor Code --><script src="some-file.js"></script>-->
This leaves a stray -->
at the end that is rendered out as live text.
I've never seen this before. Didn't think it was possible? My coworker says otherwise. What's going on here?
Any help would be greatly appreciated. Thanks!
Edit: To be clear, I'm not looking for a solution. The obvious solution is to remove the commented out <script>
tag. But I want to know if this is a real thing. My argument is human error.