Last modified: 2011-06-15 18:24:34 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T23270, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 21270 - onclick handler for radio button in quiz extension causes a javascript error if there is no shuffleButton
onclick handler for radio button in quiz extension causes a javascript error ...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Quiz (Other open bugs)
unspecified
All All
: Low trivial (vote)
: ---
Assigned To: Nobody - You can work on this!
http://en.wikinews.org/wiki/Wikinews:...
: patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-25 00:24 UTC by Bawolff (Brian Wolff)
Modified: 2011-06-15 18:24 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Suggested change (874 bytes, patch)
2011-06-15 00:19 UTC, Helder
Details

Description Bawolff (Brian Wolff) 2009-10-25 00:24:42 UTC
On line 119 of quiz.js we have:

	input[j].onclick = function() { this.form.shuffleButton.disabled = true; };

However shuffleButton is not always defined (for example, in cases where there is no shuffle button). Trying to read a property of an object, when the object is undefined throws an exception in javascript. Since this is in an event handler that doesn't do anything else, this doesn't really cause any problems, but it does give an ugly javascript error in the js console. If the code was put in a try block, or if it checked if shuffleButton existed before trying to set the disabled property of shuffleButton, this error could be avoided. I propose the code be changed to:

	input[j].onclick = function() { if (this.form.shuffleButton) this.form.shuffleButton.disabled = true; };

Similiar changes should also be made on line 116.

Thanks,
Bawolff
Comment 1 Helder 2011-06-15 00:19:16 UTC
Created attachment 8664 [details]
Suggested change

I don't know it this helps, but I'm attaching the patch with the changes suggested above.
Comment 2 Mark A. Hershberger 2011-06-15 18:20:48 UTC
r90129

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links