title: How to declare JavaScript and CSS XHTML-compatible?
body: <p>I'm wondering how to declare JavaScript code within a CDATA section so that it is compatible with XHTML. Which method is correct/recommended?</p>
  
  <p>Method 1:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  // &lt;![CDATA[
  CODE
  // ]]&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>Method 2:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  /* &lt;![CDATA[ */
  CODE
  /* ]]&gt; */
  &lt;/script&gt;
  </code></pre>
  
  <p>Is the second one also suitable for inline CSS?</p>
  
  <p>And, is it possible/does it make sense to add some encoding declaration here like</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt;
  ...
  &lt;style type="text/css" media="screen" charset="utf-8"&gt;
  ...
  
  or
  
  &lt;script type="text/javascript"&gt;
  @charset "utf-8";
  ...
  &lt;style type="text/css" media="screen"&gt;
  @charset "utf-8";
  ...
  </code></pre>