mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-23 22:13:40 +00:00
Don't try to highlight elements not in a code block
The 'hll' CSS only targets the .linenos selector, but it doesn't hurt to avoid unnecessary DOM changes. Change-Id: Ic7134619606c6e4abc2480ddc9650d0352fc33da
This commit is contained in:
parent
8f09ace86b
commit
63c5943a9f
|
@ -5,7 +5,11 @@ $( function () {
|
|||
function onHashChange() {
|
||||
// Don't assume location.hash will be parseable as an ID (T271572)
|
||||
var $line = $( document.getElementById( location.hash.slice( 1 ) ) || [] );
|
||||
// TODO: Check the element is in fact a line marker
|
||||
|
||||
if ( !$line.closest( '.mw-highlight' ).length ) {
|
||||
// Matched ID wasn't in a highlight block
|
||||
$line = $( [] );
|
||||
}
|
||||
|
||||
if ( $lastLine ) {
|
||||
$lastLine.removeClass( 'hll' );
|
||||
|
|
Loading…
Reference in a new issue