Don't start HTML responses with <?xml if the document is served as text/html.

Starting a text/html mime type document with <?xml causes some browsers (previous version of Opera and IE) to switch to Quirks Mode.
This commit is contained in:
Craig Andrews 2009-08-05 18:55:47 -04:00
parent 95ba22c5d7
commit b975a6a0e5
1 changed files with 7 additions and 2 deletions

View File

@ -109,8 +109,13 @@ class HTMLOutputter extends XMLOutputter
header('Content-Type: '.$type);
$this->extraHeaders();
$this->startXML('html');
if( ! substr($type,0,strlen('text/html'))=='text/html' ){
// Browsers don't like it when <?xml it output for non-xhtml documents
$this->xw->startDocument('1.0', 'UTF-8');
}
if ($doc) {
$this->xw->writeDTD('html', $public, $system);
}
$language = $this->getLanguage();