diff --git a/includes/CommentFormatter.php b/includes/CommentFormatter.php index 66b61d4c7..8fe799353 100644 --- a/includes/CommentFormatter.php +++ b/includes/CommentFormatter.php @@ -112,7 +112,7 @@ class CommentFormatter { $wrapperNode = $headingElement->parentNode; if ( !( $wrapperNode instanceof Element && - DOMCompat::getClassList( $wrapperNode )->contains( 'mw-heading' ) + DOMUtils::hasClass( $wrapperNode, 'mw-heading' ) ) ) { // Do not add the wrapper if the heading has attributes generated from wikitext (T353489). // Only allow reserved attributes (e.g. 'data-mw', which can't be used in wikitext, but which @@ -379,7 +379,7 @@ class CommentFormatter { $headings = DOMCompat::querySelectorAll( $container, 'h2' ); foreach ( $headings as $headingElement ) { $wrapper = $headingElement->parentNode; - if ( $wrapper instanceof Element && DOMCompat::getClassList( $wrapper )->contains( 'toctitle' ) ) { + if ( $wrapper instanceof Element && DOMUtils::hasClass( $wrapper, 'toctitle' ) ) { continue; } $headingElement = static::handleHeading( $headingElement ); diff --git a/includes/CommentParser.php b/includes/CommentParser.php index 7da5a9b7f..db348bdcc 100644 --- a/includes/CommentParser.php +++ b/includes/CommentParser.php @@ -25,6 +25,7 @@ use Wikimedia\Parsoid\DOM\Element; use Wikimedia\Parsoid\DOM\Node; use Wikimedia\Parsoid\DOM\Text; use Wikimedia\Parsoid\Utils\DOMCompat; +use Wikimedia\Parsoid\Utils\DOMUtils; use Wikimedia\Timestamp\TimestampException; // TODO consider making timestamp parsing not a returned function @@ -563,7 +564,7 @@ class CommentParser { */ private function getUsernameFromLink( Element $link ): ?array { // Selflink: use title of current page - if ( DOMCompat::getClassList( $link )->contains( 'mw-selflink' ) ) { + if ( DOMUtils::hasClass( $link, 'mw-selflink' ) ) { $title = $this->title; } else { $titleString = CommentUtils::getTitleFromUrl( $link->getAttribute( 'href' ) ?? '', $this->config ) ?? ''; @@ -739,9 +740,8 @@ class CommentParser { ) { return NodeFilter::FILTER_REJECT; } - $classList = DOMCompat::getClassList( $node ); // Don't attempt to parse blocks marked 'mw-notalk' - if ( $classList->contains( 'mw-notalk' ) ) { + if ( DOMUtils::hasClass( $node, 'mw-notalk' ) ) { return NodeFilter::FILTER_REJECT; } // Don't detect comments within references. We can't add replies to them without bungling up @@ -749,7 +749,7 @@ class CommentParser { if ( //