Adding check for illegal attributes in references tag

Bug: T51538
Change-Id: I7dbc577a61abb660d2bdb66ead0d7b71fd66cf47
This commit is contained in:
sbailey 2020-10-30 12:57:40 -07:00 committed by jenkins-bot
parent 4310b6a243
commit 01cf61ad67

View file

@ -413,6 +413,18 @@ class References extends ExtensionTagHandler {
if ( !$isTplWrapper ) {
$dataMw = DOMDataUtils::getDataMw( $refsNode );
// Detect invalid parameters on the references tag
$knownAttributes = [ 'group', 'responsive' ];
foreach ( $dataMw->attrs as $key => $value ) {
if ( !in_array( strtolower( $key ), $knownAttributes, true ) ) {
self::addErrorsToNode(
$refsNode, [ [ 'key' => 'cite_error_references_invalid_parameters' ] ]
);
break;
}
}
// Mark this auto-generated so that we can skip this during
// html -> wt and so that clients can strip it if necessary.
if ( $autoGenerated ) {