Page MenuHomePhabricator

Exception thrown on donate.wikimedia.org due to non-existing "monthly-link" element ID
Closed, ResolvedPublic

Description

Screenshot of exception

Following code throws an exception on all pages currently:

<ul class="form-info-links">
  <!--  <li><a id="monthly-link" href="..">..</a></li>-->
  <li><a id="onetime-link" href="..">..</a></li>
</ul>
<script>
  ..
  document.getElementById('monthly-link').href = baseURL + $.param(paramsOut);
  $('#monthly-link').show();
 ..

Because "monthly-link" doesn't exist.

  • If you comment out a link, think further and also disable related code
  • Use jQuery for both statements so this doesn't happen
  • Test (!)
  • Krinkle

... because document.getElementById('monthly-link') returns null if there is no such ID in the document (comments don't run)


Version: unspecified
Severity: critical
Whiteboard: aklapper-moreinfo

Attached:

Screen_Shot_-_donatewiki_Exception.png (647×1 px, 259 KB)

Details

Reference
bz40152

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:47 AM
bzimport set Reference to bz40152.
bzimport added a subscriber: Unknown Object (MLST).

I would've fixed it myself, but the output is a bit messy, no idea where this inline stuff is coming from.

The offending line now says:
$('#monthly-link').attr('href', baseURL + $.param(paramsOut));

Could somebody from the Fundraising time confirm this is fixed?
(Or could Krinkle reassure that this is obsolete now, see comment 2?)

(In reply to comment #2)

The offending line now says:
$('#monthly-link').attr('href', baseURL + $.param(paramsOut));

Indeed, it no longer throws an exception this way. Marking WORKSFORME.

I wouldn't say fixed because it still doesn't make sense to have dozens of inline script tags, global variables and commented out HTML without also commenting out the related logic and what not. It is a big mess.

pgehres wrote:

(In reply to comment #4)

I wouldn't say fixed because it still doesn't make sense to have dozens of
inline script tags, global variables and commented out HTML without also
commenting out the related logic and what not. It is a big mess.

Welcome to donatewiki, It's a Big Mess (TM). It on Fundraising's radar to overhaul since it was written in haste before the 2011 Fundraiser and hasn't gotten any attention since then.

Thanks for letting us know about things like this.