[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#432038: qa.debian.org: DDPO HTML does not validate



tags 432038 patch
thanks

Hi,

On Saturday 7 July 2007 00:13, Felix C. Stegerman wrote:
> Visting http://qa.debian.org/developer.php?login=username@debian.org,
> I saw a "Valid HTML 4.0!" image and [on impulse] clicked on it.  To my
> surprise, the page did not validate!

Here's a patch that fixes this, against current SVN.

isset() will also match parameters that are the empty string,
which is the default for some parameters in the function definition, and will 
thus cause output like 'rowspan=""'. Use empty() which will handle this 
correctly.


Thijs
Index: common-html.php
===================================================================
--- common-html.php	(revision 1561)
+++ common-html.php	(working copy)
@@ -199,9 +199,9 @@
 */
 function html_td($data, $width = "", $colspan = "", $rowspan = "")
 {
-    if (isset($width)) $width = " width=\"".$width."\"";
-    if (isset($rowspan)) $rowspan = " rowspan=\"".$rowspan."\"";
-    if (isset($colspan)) $colspan = " colspan=\"".$colspan."\"";
+    if (!empty($width)) $width = " width=\"".$width."\"";
+    if (!empty($rowspan)) $rowspan = " rowspan=\"".$rowspan."\"";
+    if (!empty($colspan)) $colspan = " colspan=\"".$colspan."\"";
     return "<td".$width.$rowspan.$colspan.">".$data."</td>\n";
 }
 
@@ -256,8 +256,8 @@
 */
 function html_a($text, $link, $class = "", $title = "")
 {
-    if (isset($title)) $title = " title=\"".$title."\"";
-    if (isset($class)) $class = " class=\"".$class."\"";
+    if (!empty($title)) $title = " title=\"".$title."\"";
+    if (!empty($class)) $class = " class=\"".$class."\"";
     return "<a".$class." href=\"".$link."\"".$title.">".$text."</a>";
 }
 function html_a_name($text, $name)

Attachment: pgp0ILYL_ZDjR.pgp
Description: PGP signature


Reply to: