mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-23 18:38:18 +00:00
Don't pass an empty string to getElementById to avoid Firefox warning
Bug: T315614 Change-Id: I6d4eedd75a23f6ada26aedca54da80c5e33ea4f0
This commit is contained in:
parent
e8068f2bf6
commit
837591f12e
|
@ -401,6 +401,11 @@ function clearHighlightTargetComment( threadItemSet ) {
|
|||
* @return {Element|null} Element, if found
|
||||
*/
|
||||
function getTargetFromFragment( hash ) {
|
||||
if ( !hash ) {
|
||||
// Firefox emits a console warning if you pass an empty string
|
||||
// to getElementById (T272844).
|
||||
return null;
|
||||
}
|
||||
// Per https://html.spec.whatwg.org/multipage/browsing-the-web.html#target-element
|
||||
// we try the raw fragment first, then the percent-decoded fragment.
|
||||
return document.getElementById( hash ) ||
|
||||
|
|
Loading…
Reference in a new issue