[BUGFIX] Use "id" attribute for HMENU images in HTML5 41/45141/2
authorBenni Mack <benni@typo3.org>
Sat, 5 Dec 2015 13:06:54 +0000 (14:06 +0100)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Sun, 6 Dec 2015 11:59:13 +0000 (12:59 +0100)
When setting no config.doktype=html5, then the TYPO3
Frontend renders everything as HTML5, except for
the "name" attribute for before/after logic of HMENUs,
which should use "id" attributes.

The "default" option needs to be taken into account
in order to use "id" instead of "name".

Resolves: #62487
Releases: master
Change-Id: If4cccffd499de4c81b862fa2a2e0fb194ac3bcec
Reviewed-on: https://review.typo3.org/45141
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php

index 596ee67..180a8af 100644 (file)
@@ -250,7 +250,7 @@ abstract class AbstractMenuContentObject
         $this->mconf = $conf[$this->menuNumber . $objSuffix . '.'];
         $this->debug = $tsfe->debug;
         $this->WMcObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
-        // In XHTML there is no "name" attribute anymore
+        // In XHTML and HTML5 there is no "name" attribute anymore
         switch ($tsfe->xhtmlDoctype) {
             case 'xhtml_strict':
                 // intended fall-through
@@ -259,6 +259,9 @@ abstract class AbstractMenuContentObject
             case 'xhtml_2':
                 // intended fall-through
             case 'html5':
+                // intended fall-through
+            case '':
+                // empty means that it's HTML5 by default
                 $this->nameAttribute = 'id';
                 break;
             default: