The call to `wfArrayFilterByKey` / `isReservedDataAttribute` removes
all attributes that are not reserved (`/^data-(ooui|mw|parsoid)/i`).
The `class` attribute is not reserved, and is therefore unfortunately
removed. Moving the addition of $attribs['class'] will allow overriding
of the sanitizer, and actually add the attribute.
It is also moved below the Hooks::run call so that extensions can
effectively add the classes, and SpecialNewpages will not disregard
the changes to `$classes` from hooks.
This behaviour / placement is consistent with other calls to
`wfArrayFilterByKey` / `isReservedDataAttribute`, such as
`OldChangesList`, `DeletedContribsPager`, and `ContribsPager`.
Bug: T173556
Change-Id: I40e5e98228dae79a2de39efc28091cc9f69f64ea
$oldTitleText = '';
$oldTitle = Title::makeTitle( $result->rc_namespace, $result->rc_title );
$oldTitleText = '';
$oldTitle = Title::makeTitle( $result->rc_namespace, $result->rc_title );
- if ( count( $classes ) ) {
- $attribs['class'] = implode( ' ', $classes );
- }
-
if ( !$title->equals( $oldTitle ) ) {
$oldTitleText = $oldTitle->getPrefixedText();
$oldTitleText = Html::rawElement(
if ( !$title->equals( $oldTitle ) ) {
$oldTitleText = $oldTitle->getPrefixedText();
$oldTitleText = Html::rawElement(
Hooks::run( 'NewPagesLineEnding', [ $this, &$ret, $result, &$classes, &$attribs ] );
$attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] );
Hooks::run( 'NewPagesLineEnding', [ $this, &$ret, $result, &$classes, &$attribs ] );
$attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] );
+ if ( count( $classes ) ) {
+ $attribs['class'] = implode( ' ', $classes );
+ }
+
return Html::rawElement( 'li', $attribs, $ret ) . "\n";
}
return Html::rawElement( 'li', $attribs, $ret ) . "\n";
}