Well, today I learned that <!-- this --> is syntactically acceptable JavaScript
-
-
I can't find any reference to this in the specification, but seemingly every JavaScript engine accepts it, for obvious historical reasons
-
It's so you could do <script type="text/javascript"><!-- console.log('hi'); //--></script> and avoid interpreting JS as HTML
- 2 more replies
New conversation -
-
-
they're there so pages can embed Javascript and still run on netscape 1.0, no?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
but it's only for single-line stuff?
-
I thought it was advised for multiline too to hide from non js browsers (and maybe be xhtml compliant)
End of conversation
New conversation -
-
-
iirc it was originally to allow for XHTML to parse cleanly (see: http://stackoverflow.com/questions/66837/when-is-a-cdata-section-necessary-within-a-script-tag …) and then got grandfathered in for compatibility
-
(even though XHTML is more or less dead in practice now)
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.