Why does Google split the – Waleed Khan Oct 30 '12 at 12:14

  • 1
    I believe it has something to do with the face that some CMS's MAY filter anything that starts with – Vic V Oct 30 '12 at 12:14
  • 1 Answers1

    1

    In some cases where Javascript is processed or handled -- for example when the code is embedded into an HTML page -- the character sequences </script and <script are processed separately, before the Javascript is parsed to identify string constants and the like.

    Therefore it is more robust to make sure that Javascript code one writes never contains these character sequences. It is arguably a good defensive habit to do this even for code that is not currently being processed by systems that would be broken by </script> -- because that will prevent problems in case the code is later copy-pasted into a context where </script> does produce a problem.

    hmakholm left over Monica
    • 23,074
    • 3
    • 51
    • 73