From 3624d89c8bfa99c99dfc5039cb8a8f2b13f27b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 31 Jan 2023 01:32:02 +0100 Subject: [PATCH] Don't add custom attributes in unwrapParsoidSections() This code was unnecessarily copied from VE. It's not needed for anything in this extension, and it causes the headings to be treated as modified by selser, which in turn causes dirty diffs. Bug: T328268 Change-Id: Ibdbed430f2ff28d0ea2e67644075c1621d9fae53 --- includes/CommentUtils.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/includes/CommentUtils.php b/includes/CommentUtils.php index b732d19df..fd6453e72 100644 --- a/includes/CommentUtils.php +++ b/includes/CommentUtils.php @@ -452,24 +452,11 @@ class CommentUtils { * Unwrap Parsoid sections * * @param Element $element Parent element, e.g. document body - * @param string|null $keepSection Section to keep */ - public static function unwrapParsoidSections( - Element $element, string $keepSection = null - ): void { + public static function unwrapParsoidSections( Element $element ): void { $sections = DOMCompat::querySelectorAll( $element, 'section[data-mw-section-id]' ); foreach ( $sections as $section ) { $parent = $section->parentNode; - $sectionId = $section->getAttribute( 'data-mw-section-id' ); - // Copy section ID to first child (should be a heading) - if ( $sectionId !== null && $sectionId !== '' && intval( $sectionId ) > 0 ) { - $firstChild = $section->firstChild; - Assert::precondition( $firstChild instanceof Element, 'Section has a heading' ); - $firstChild->setAttribute( 'data-mw-section-id', $sectionId ); - } - if ( $keepSection !== null && $sectionId === $keepSection ) { - return; - } while ( $section->firstChild ) { $parent->insertBefore( $section->firstChild, $section ); }