mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-15 10:27:31 +00:00
Merge "Fix broken reference popup when name contains # character"
This commit is contained in:
commit
ab64229a4d
|
@ -16,17 +16,16 @@ module.exports = function () {
|
||||||
* @param {jQuery.Event} ev Click event of the reference element
|
* @param {jQuery.Event} ev Click event of the reference element
|
||||||
*/
|
*/
|
||||||
function showReference( ev ) {
|
function showReference( ev ) {
|
||||||
var urlComponents,
|
var $dest = $( ev.currentTarget ),
|
||||||
$dest = $( ev.currentTarget ),
|
|
||||||
href = $dest.attr( 'href' );
|
href = $dest.attr( 'href' );
|
||||||
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
// If necessary strip the URL portion of the href so we are left with the
|
// If necessary strip the URL portion of the href so we are left with the
|
||||||
// fragment
|
// fragment
|
||||||
urlComponents = href.split( '#' );
|
var i = href.indexOf( '#' );
|
||||||
if ( urlComponents.length > 1 ) {
|
if ( i > 0 ) {
|
||||||
href = '#' + urlComponents[ 1 ];
|
href = href.slice( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
references.showReference( href, currentPage, $dest.text(),
|
references.showReference( href, currentPage, $dest.text(),
|
||||||
|
|
Loading…
Reference in a new issue