Lasse said:
I wouldn't deprecate post/pre decrement for that reason (I actually
like them when used responsibly), but yes, it does make little sense
to use <!-- and //--> to comment out a script if the script includes
the "--" character sequence. But it made little sense to begin with
Well, this issue was semi-cleared in the last year "quote-to-death"
discussion about <script> and comments
The trick is that everyone in the scheme acts by <Give to Caesar what
is Caesar's, and to God what is God's>
HTML parser locates <script> </script> fragment and forwards
*everything* what is between > and < right to the script engine. It
doesn't try to validate or anyhow check what a hell it's sending to the
engine.
The engine gets the chunk and before anything else, without trying to
understand what a hell it got, peel it like a banana from the starting
<!-- and the ending //-->
Only then it starts to read that kind of crap it got this time. So you
can put any decrements inside with no fear. Besides is it was shown
that "--" by itself doesn't *officially* end the comment. It just ends
a comment section within the same comment. But again it's irrelevant to
this situation because the interpreter doesn't give a damn what's
inside until the banana is peeled out.
As I've shown yesterday, Firefox (and some other browsers?) are trying
to be finicky about the skin: like Firefox peels <!-- //--> like no
problem but it pretends to be upset if it's <[CDATA[. That is nothing
but fallacy to please some sensitive hearts in W3C. With above
algorithm we could start each script with !@#$ and end up with %^&*
What would not have any practical sense - but no change in algorithm
would be needed.
One just has to stop to try to find a standard in this pre-historic
mechanics. It is because it is, and it's enough as an explanation.
Appendix in our stomach is not used anymore for Him knows how long, but
no one seems to be sleepless to find its "purpose in the modern world".
Neither someone is calling to immediately genetically change the
humanity to free it up from this rudiment. So let the <script><!-- will
not spoil your mood neither. ;-)