Add missing escaping for jQuery ID selector

We run into this issue already one time, see Ifb5fe89 (T214710). The
exact same applies here.

The effect of this bug is that for certain references (typically ones
with a colon character in their name) the "jump down" link will be
broken.

Change-Id: Ic6723bd910cb5e5e1e1872ce39f2e271012245de
This commit is contained in:
Thiemo Kreuz 2019-03-13 15:31:16 +01:00
parent d816f230b5
commit 932271b6db
3 changed files with 3 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View file

@ -7,7 +7,8 @@ import { escapeHTML } from '../templateUtil';
// Known citation type strings currently supported with icons and messages.
const KNOWN_TYPES = [ 'book', 'journal', 'news', 'web' ],
mw = mediaWiki;
mw = mediaWiki,
$ = jQuery;
/**
* @param {ext.popups.PreviewModel} model
@ -51,7 +52,7 @@ export function renderReferencePreview(
if ( model.sourceElementId ) {
$el.find( '.mwe-popups-read-link' ).on( 'click', ( event ) => {
event.stopPropagation();
$( `#${ model.sourceElementId } > a` ).trigger( 'click' );
$( `#${ $.escapeSelector( model.sourceElementId ) } > a` ).trigger( 'click' );
} );
}