Ok, here's one to put on your "Oh Dear Lord That's Retarded" list:
The following code produces no errors but fails to run either.
<b>this displays</b>
<script type='text/javascript'>
/* detect a comment */
if (document.getElementById('field').value.match(/<!--/))
alert('You entered a Comment');
</script>
More stuff that displays
Ok, that's greatly simplified, but for IE and Opera the above produces no Javascript errors or warnings, it simply doesn't work. Using the various consoles only states that there's no code there and that you should only set breakpoints where there's code.
This works peachy keen in Firefox.
Several freshly plucked forehead impressions into a desk later you'll figure out that '<!–' is interpreted by IE and Opera before <script> is and that it will happily consider all the content of that script tag invalid with no warning or error. Isn't that nice?
The solution is to break the "comment" sequence which appears inside of a string in a script tag sequence so that the HTML parser doesn't get "confused".
e.g.
var comment = '< '+'!--';
i'll add that you also have to do the same inane handling if you have "<sc"+"ript>" as a string because that am smart!
*grumble*

