Merge "Get rid of one nesting level in highlighting code"

This commit is contained in:
jenkins-bot 2018-11-30 14:58:49 +00:00 committed by Gerrit Code Review
commit 8ae3b13d1a

View file

@ -45,28 +45,28 @@
textNode = textNode.firstChild;
}
if ( textNode.nodeType === Node.TEXT_NODE &&
textNode.data.trim() !== ''
) {
accessibilityLabel = mw.msg( 'cite_references_link_accessibility_back_label' );
upArrow = textNode.data.trim();
// The text node typically contains "↑ ", and we need to keep the space.
textNode.data = textNode.data.replace( upArrow, '' );
// Create a plain text and a clickable "↑". CSS :target selectors make sure only
// one is visible at a time.
$upArrowLink = $( '<a>' )
.addClass( 'mw-cite-up-arrow-backlink' )
.attr( 'aria-label', accessibilityLabel )
.attr( 'title', accessibilityLabel )
.text( upArrow );
$backlinkWrapper.prepend(
$( '<span>' )
.addClass( 'mw-cite-up-arrow' )
.text( upArrow ),
$upArrowLink
);
if ( textNode.nodeType !== Node.TEXT_NODE || textNode.data.trim() === '' ) {
return;
}
accessibilityLabel = mw.msg( 'cite_references_link_accessibility_back_label' );
upArrow = textNode.data.trim();
// The text node typically contains "↑ ", and we need to keep the space.
textNode.data = textNode.data.replace( upArrow, '' );
// Create a plain text and a clickable "↑". CSS :target selectors make sure only
// one is visible at a time.
$upArrowLink = $( '<a>' )
.addClass( 'mw-cite-up-arrow-backlink' )
.attr( 'aria-label', accessibilityLabel )
.attr( 'title', accessibilityLabel )
.text( upArrow );
$backlinkWrapper.prepend(
$( '<span>' )
.addClass( 'mw-cite-up-arrow' )
.text( upArrow ),
$upArrowLink
);
}
$upArrowLink.attr( 'href', $backlink.attr( 'href' ) );