DifferenceEngine: Don't display empty header row
authorMatmaRex <matma.rex@gmail.com>
Mon, 10 Jun 2013 17:43:47 +0000 (19:43 +0200)
committerMatmaRex <matma.rex@gmail.com>
Mon, 10 Jun 2013 17:43:47 +0000 (19:43 +0200)
This prevents a gap from appearing, and the resulting code will be
slightly cleaner as well.

Shouldn't matter in core, but does matter for extensions displaying
diffs like AbuseFilter.

Change-Id: I9e3e74226a23c0a18db091bc1550b694d9d08118

includes/diff/DifferenceEngine.php

index 4ee066e..72135f9 100644 (file)
@@ -998,11 +998,13 @@ class DifferenceEngine extends ContextSource {
                                $colspan = 1;
                                $multiColspan = 2;
                        }
-                       $header .= "
-                       <tr style='vertical-align: top;'>
-                       <td colspan='$colspan' class='diff-otitle'>{$otitle}</td>
-                       <td colspan='$colspan' class='diff-ntitle'>{$ntitle}</td>
-                       </tr>";
+                       if ( $otitle || $ntitle ) {
+                               $header .= "
+                               <tr style='vertical-align: top;'>
+                               <td colspan='$colspan' class='diff-otitle'>{$otitle}</td>
+                               <td colspan='$colspan' class='diff-ntitle'>{$ntitle}</td>
+                               </tr>";
+                       }
                }
 
                if ( $multi != '' ) {