mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-23 22:13:40 +00:00
Avoid console warning when hash is empty
Bug: T272844 Change-Id: I82ed4ade24ed9e61e654cc7ea1ce19c7607086e1
This commit is contained in:
parent
e793626d52
commit
42c97fa448
|
@ -3,8 +3,10 @@ $( function () {
|
|||
var $lastLine;
|
||||
|
||||
function onHashChange() {
|
||||
// Don't assume location.hash will be parseable as an ID (T271572)
|
||||
var $line = $( document.getElementById( location.hash.slice( 1 ) ) || [] );
|
||||
var id = location.hash.slice( 1 ),
|
||||
// Don't assume location.hash will be parseable as an ID (T271572)
|
||||
// and avoid warning when id is empty (T272844)
|
||||
$line = id ? $( document.getElementById( id ) || [] ) : $( [] );
|
||||
|
||||
if ( !$line.closest( '.mw-highlight' ).length ) {
|
||||
// Matched ID wasn't in a highlight block
|
||||
|
|
Loading…
Reference in a new issue