[BUGFIX] html5 rendering does handle non-xml documents
authorSteffen Ritter <info@rs-websystems.de>
Sun, 11 Mar 2012 09:29:43 +0000 (10:29 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Tue, 13 Mar 2012 11:55:01 +0000 (12:55 +0100)
When selecting html5 in config.doctype and deactivating
config.xmlprologue = none the xmlns-attribute of <html> has
to be omitted and the xhtml-cleaning has to be deactivated.

Furthermore the non XML-Syntax of the charset meta-tag has to
be provided to the renderer.

Change-Id: I5b3d3fe084d745df2a1cc98c614ba1fff173a4db
Fixes: #34730
Releases: 4.8,4.7,4.6
Reviewed-on: http://review.typo3.org/9537
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
Reviewed-by: Ingo Pfennigstorf
Tested-by: Ingo Pfennigstorf
Reviewed-by: Stefan Neufeind
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/cms/tslib/class.tslib_pagegen.php

index ab70590..57db5ad 100644 (file)
@@ -317,9 +317,12 @@ class TSpagegen {
 
                        // Setting document type:
                $docTypeParts = array ();
+               $xmlDocument = TRUE;
                // Part 1: XML prologue
                switch ((string) $GLOBALS['TSFE']->config['config']['xmlprologue']) {
                        case 'none' :
+                               $xmlDocument = FALSE;
+                               $GLOBALS['TSFE']->config['config']['xhtml_cleaning'] = 'none';
                                break;
                        case 'xml_10' :
                                $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';
@@ -375,7 +378,11 @@ class TSpagegen {
                                        break;
                                case 'html5' :
                                        $docTypeParts[] = '<!DOCTYPE html>';
-                                       $pageRenderer->setMetaCharsetTag('<meta charset="|" />');
+                                       if ($xmlDocument){
+                                               $pageRenderer->setMetaCharsetTag('<meta charset="|" />');
+                                       } else {
+                                               $pageRenderer->setMetaCharsetTag('<meta charset="|">');
+                                       }
                                        break;
                                case 'none' :
                                        break;
@@ -393,7 +400,8 @@ class TSpagegen {
                if ($GLOBALS['TSFE']->xhtmlVersion < 110 || $doctype === 'html5') {
                        $htmlTagAttributes['lang'] = $htmlLang;
                }
-               if ($GLOBALS['TSFE']->xhtmlVersion || $doctype === 'html5') {
+
+               if ($GLOBALS['TSFE']->xhtmlVersion || ($doctype === 'html5' && $xmlDocument)) {
                        $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml'; // We add this to HTML5 to achieve a slightly better backwards compatibility
                        if (is_array($GLOBALS['TSFE']->config['config']['namespaces.'])) {
                                foreach ($GLOBALS['TSFE']->config['config']['namespaces.'] as $prefix => $uri) {