Skip to content

Commit 3fe4413

Browse files
chore: drop this; fix was something else
1 parent 8a927d8 commit 3fe4413

1 file changed

Lines changed: 0 additions & 34 deletions

File tree

includes/ProgressTableProcessor.php

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ private function sanitizeRowId( string $rowId ): string {
495495
* (here in a separate function incase we want to wrap the table in a container or something later)
496496
*/
497497
private function generateFinalHtml(): string {
498-
$this->trimWhitespaceNodes();
499498
return trim( $this->dom->saveHTML( $this->table ) );
500499
}
501500

@@ -547,37 +546,4 @@ public function hasError(): bool {
547546
public function getErrorMessage(): ?string {
548547
return $this->errorMessage;
549548
}
550-
551-
/**
552-
* Remove whitespace-only text nodes from structural table elements.
553-
* MediaWiki reparses extension HTML later, and stray whitespace nodes in table structure
554-
* can be reparented outside the table into blank paragraphs. This is most prevalant when using DPL4, which
555-
* emits <td>\n</td> instead of <td></td>. For some reason the parser kicks these out of the table if they appear
556-
* at the beginning of the table (such as when using location=last) causing line breaks
557-
* @return void [modifies return of ->recursiveTagParse()]
558-
*/
559-
private function trimWhitespaceNodes(): void {
560-
$xpath = new DOMXPath( $this->dom );
561-
// I don't like this but best we got (need to see how much this costs performance wise)
562-
$textNodes = $xpath->query(
563-
'.//text()[normalize-space(.) = "" and ' .
564-
'( parent::table or parent::thead or parent::tbody or parent::tfoot or parent::tr )]',
565-
$this->table
566-
);
567-
568-
// nought to be done
569-
if ( !$textNodes ) {
570-
return;
571-
}
572-
573-
$nodesToRemove = [];
574-
foreach ( $textNodes as $node ) {
575-
$nodesToRemove[] = $node;
576-
}
577-
578-
foreach ( $nodesToRemove as $node ) {
579-
$node->parentNode?->removeChild( $node );
580-
}
581-
}
582-
583549
}

0 commit comments

Comments
 (0)