[Typo3-dev] XHTML 1.1 bug

Ernesto Baschny ernst at baschny.de
Fri Dec 24 19:12:48 CET 2004


Hi!

There are some <div align=".."> being added by Typo3 (e.g. in wrapAlign for 
IMAGE/IMGTEXT captions, etc). This is not XHTML 1.1 compatible, since there is no 
"align" attribute allowed for <div>. The solution is to replace those with <div style="text-
align:...;">.

Attached is a patch to Typo3 (latest HEAD from CVS) to correct this behaviour.

Cheers and merry Chrismas,
Ernesto

-- 
Ernesto Baschny <ernst at baschny.de>
http://www.baschny.de
ICQ 2955403

Fingerprint: E4 30 41 F3 61 BC B4 9F  38 2D B6 4E D1 CE F5 
8F


-------------- next part --------------
--- typo3/sysext/cms/tslib/class.tslib_content.php.orig	Fri Dec 24 19:09:14 2004
+++ typo3/sysext/cms/tslib/class.tslib_content.php	Fri Dec 24 19:10:23 2004
@@ -1084,10 +1084,10 @@
 			$spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
 			switch ($contentPosition)	{
 				case '0':	// above
-					$output= '<div align="'.$align.'">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
+					$output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
 				break;
 				case '8':	// below
-					$output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div align="'.$align.'">'.$tablecode.'</div>';
+					$output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';
 				break;
 				case '16':	// in text
 					$output= $tablecode.$content;
@@ -3063,7 +3063,7 @@
 
 				if ($conf['wrapAlign'] || $conf['wrapAlign.']){
 					$wrapAlign = trim($this->stdWrap($conf['wrapAlign'], $conf['wrapAlign.']));
-					if ($wrapAlign)	{$content=$this->wrap($content, '<div align="'.$wrapAlign.'">|</div>');}
+					if ($wrapAlign)	{$content=$this->wrap($content, '<div style="text-align:'.$wrapAlign.';">|</div>');}
 				}
 				if ($conf['typolink.']){$content=$this->typolink($content, $conf['typolink.']);}
 
@@ -3565,7 +3565,7 @@
 			$theValue=$this->wrap($theValue, $fontWrap);
 		}
 			// align
-		if ($align)	{$theValue=$this->wrap($theValue, '<div align="'.$align.'">|</div>');}
+		if ($align)	{$theValue=$this->wrap($theValue, '<div style="text-align:'.$align.';">|</div>');}
 			// return
 		return $theValue;
 	}


More information about the TYPO3-dev mailing list