mozilla

Revision 90493 of Writing JavaScript for XHTML

  • Revision slug: Talk:Writing_JavaScript_for_XHTML
  • Revision title: Writing JavaScript for XHTML
  • Revision id: 90493
  • Created:
  • Creator: Bzbarsky
  • Is current revision? Yes
  • Comment 19 words added; page language changed to English

Revision Content

Couple of notes :

1) The php example for detecting if the client accepts xhtml+xml will result in a php error of the client doesn't send what it accepts.

if (isset($_SERVER['HTTP_ACCEPT')) {
if( strpos( $_SERVER['HTTP_ACCEPT'], "application/xhtml+xml" ) ) {
  header( "Content-type: application/xhtml+xml" );
  echo '<?xml version="1.0" ?>'."\n";
} else {
  header( "Content-type: text/html" );
} else {
  header( "Content-type: text/html" );
}

solves that.

2) If you use the above trick, then you can't use the CDATA trick because it seems to cause issues in non xhtml+xml.

3) The "DOM changed" section is almost entirely incorrect.  Should we just remove it?

Revision Source

<p>Couple of notes :</p>
<p>1) The php example for detecting if the client accepts xhtml+xml will result in a php error of the client doesn't send what it accepts.</p>
<pre class="eval">if (isset($_SERVER['HTTP_ACCEPT')) {
if( strpos( $_SERVER['HTTP_ACCEPT'], "application/xhtml+xml" ) ) {
  header( "Content-type: application/xhtml+xml" );
  echo '&lt;?xml version="1.0" ?&gt;'."\n";
} else {
  header( "Content-type: text/html" );
} else {
  header( "Content-type: text/html" );
}

solves that.
</pre>
<p>2) If you use the above trick, then you can't use the CDATA trick because it seems to cause issues in non xhtml+xml.</p>
<p>3) The "DOM changed" section is almost entirely incorrect.  Should we just remove it?</p>
Revert to this revision