MMV: Allow <sub> and <sup> in captions

As we already allow visual markup in captions, I see no reason to not
whitelist sup and sub. These elements are even allowed in the
displaytitle whitelist for articles, so seems appropriate to have them
for media captions as well.

Bug: T186844
Change-Id: I4339ee85d139301770a4e15650c9dc0d64c136cd
This commit is contained in:
Derk-Jan Hartman 2018-02-09 10:29:47 +01:00
parent 1657e4241e
commit 340e7680a1
2 changed files with 3 additions and 3 deletions

View file

@ -222,7 +222,7 @@
$html = this.wrapAndJquerify( html );
this.filterInvisible( $html );
this.appendWhitespaceToBlockElements( $html );
this.whitelistHtml( $html, 'a, span, i, b' );
this.whitelistHtml( $html, 'a, span, i, b, sup, sub' );
cache.textWithTags[ html ] = this.mergeWhitespace( $html.html() );
}
return cache.textWithTags[ html ];

View file

@ -168,9 +168,9 @@
QUnit.test( 'htmlToTextWithTags()', function ( assert ) {
var utils = new mw.mmv.HtmlUtils(),
html = '<table><tr><td><b>F</b>o<i>o</i></td><td><a>bar</a></td><td style="display: none">baz</td></tr></table>';
html = '<table><tr><td><b>F</b>o<i>o</i><sub>o</sub><sup>o</sup></td><td><a>bar</a></td><td style="display: none">baz</td></tr></table>';
assert.strictEqual( utils.htmlToTextWithTags( html ), '<b>F</b>o<i>o</i> <a>bar</a>', 'works' );
assert.strictEqual( utils.htmlToTextWithTags( html ), '<b>F</b>o<i>o</i><sub>o</sub><sup>o</sup> <a>bar</a>', 'works' );
} );
QUnit.test( 'isJQueryOrHTMLElement()', function ( assert ) {