[!!!][BUGFIX] Assign first class for tables in HTMLparser 49/39349/8
authorFrederic Gaus <frederic.gaus@flagbit.de>
Fri, 8 May 2015 07:17:40 +0000 (09:17 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 7 Aug 2015 12:35:46 +0000 (14:35 +0200)
When the given class of a table is not valid by configuration,
the HTMLparser should assign the first class in configuration instead
of generating an empty class attribute.

Releases: master
Resolves: #24186
Change-Id: Ia57c036aaf81973e8d7fe26861c78de217013c75
Reviewed-on: http://review.typo3.org/39349
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/Html/HtmlParser.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-24186-HTMLparser-FixAttribclasslistDoesNotAssignFirstElementWhenAttributeValueNotInList.rst [new file with mode: 0644]

index 25467b2..f325488 100644 (file)
@@ -844,7 +844,7 @@ class HtmlParser {
                                                                                                        if (!empty($newClasses)) {
                                                                                                                $tagAttrib[0][$attr] = implode(' ', $newClasses);
                                                                                                        } else {
-                                                                                                               $tagAttrib[0][$attr] = '';
+                                                                                                               $tagAttrib[0][$attr] = $params['list'][0];
                                                                                                        }
                                                                                                } else {
                                                                                                        if (!in_array($this->caseShift($tagAttrib[0][$attr], $params['casesensitiveComp']), $this->caseShift($params['list'], $params['casesensitiveComp'], $tagName))) {
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-24186-HTMLparser-FixAttribclasslistDoesNotAssignFirstElementWhenAttributeValueNotInList.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-24186-HTMLparser-FixAttribclasslistDoesNotAssignFirstElementWhenAttributeValueNotInList.rst
new file mode 100644 (file)
index 0000000..c267c1a
--- /dev/null
@@ -0,0 +1,18 @@
+Breaking: #24186 - HTMLparser - fixAttrib.['class'].list does not assign first element, when attribute value not in list
+=========================================================================================================================
+
+Description
+===========
+
+The HTMLparser now assigns the first class of ``fixAttrib.class.list`` when none of the given class name values
+are found in the configured list. Until now the class attribute of the rendered HTMl tag was just empty in that case.
+
+Impact
+======
+
+A HTMl element that had no class before could now have been assigned a class.
+
+Migration
+=========
+
+Add a class from the configured list to the HTML element or add a class at the first position of ``fixAttrib.class.list``.