00763: GUI buttons produce invalid XHTML

Summary: GUI buttons produce invalid XHTML
Created: 2006-06-25 23:58
Status: Closed (fixed in 2.2.1)
Category: Bug
From: Meista?
Assigned:
Priority: 3
Version: 2.1.11
OS: FreeBSD 4 / Apache 2.2 / PHP 5.1.4

Description:

If the GUI buttons are enabled, the edit form contains invalid XHTML. See the W3C Markup Validator's output for this PmWiki:
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.pmwiki.org%2Fwiki%2FPmWiki%2FPmWiki%3Faction%3Dedit

The errors occur in the embedded JavaScript block, since it is not within a HTML comment. The following patch for scripts/guiedit.php should fix the problem (it simply adds <!-- ... //-->):

--- guiedit.php.old     Mon Jun 26 04:18:19 2006
+++ guiedit.php Mon Jun 26 04:19:34 2006
@@ -58,7 +58,7 @@
   global $GUIButtons;
   $cmpfn = create_function('$a,$b', 'return $a[0]-$b[0];');
   usort($GUIButtons, $cmpfn);
-  $out = "<script language='javascript' type='text/javascript'>\n";
+  $out = "<script language='javascript' type='text/javascript'>\n<!--\n";
   foreach ($GUIButtons as $k => $g) {
     if (!$g) continue;
     @list($when, $mopen, $mclose, $mtext, $tag, $mkey) = $g;
@@ -76,7 +76,7 @@
     $out .= 
       "insButton(\"$mopen\", \"$mclose\", '$mtext', \"$tag\", \"$mkey\");\n";
   }
-  $out .= '</script>';
+  $out .= "//-->\n</script>";
   return $out;
 }