https://bugzilla.wikimedia.org/show_bug.cgi?id=21270
Summary: onclick handler for radio button in quiz extension
causes a javascript error if there is no shuffleButton
Product: MediaWiki extensions
Version: any
Platform: All
URL: http://en.wikinews.org/wiki/Wikinews:World_News_Quiz
OS/Version: All
Status: NEW
Severity: trivial
Priority: Normal
Component: Quiz
AssignedTo: [email protected]
ReportedBy: [email protected]
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
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l