Last modified: 2006-07-06 23:24:29 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 6565 - Adding some var declarations to MediaWiki's JavaScript.
Adding some var declarations to MediaWiki's JavaScript.
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.7.x
All All
: Normal minor with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-06 10:01 UTC by Nick Jenkins
Modified: 2006-07-06 23:24 UTC (History)
0 users

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


Attachments
Wikibits var declarations (756 bytes, patch)
2006-07-06 10:01 UTC, Nick Jenkins
Details

Description Nick Jenkins 2006-07-06 10:01:09 UTC
Adding some var declarations to MediaWiki's JavaScript for maximum correctness
for issues reported by "FireBug" (a firefox JavaScript correctness checking
extension). Will attach a diff with these shortly. 

Also the place in the default [[MediaWiki:Monobook.js]] where the tooltip /
access key JS is declared should be updated like so:
======================================
   /* tooltips and access keys */
-  ta = new Object();
+  var ta = new Object();
   ta['pt-userpage'] = new Array('.','My user page');
   ta['pt-anonuserpage'] = new Array('.','The user page for the ip you\'re
editing as');
======================================
Comment 1 Nick Jenkins 2006-07-06 10:01:59 UTC
Created attachment 2052 [details]
Wikibits var declarations

Attaching diff with var declarations as per above.
Comment 2 Rotem Liss 2006-07-06 11:04:59 UTC
r15372.
Comment 3 Nick Jenkins 2006-07-06 11:42:02 UTC
Thank you!
Comment 4 Brion Vibber 2006-07-06 16:59:12 UTC
Er, what's wrong here? These are global declarations.
Comment 5 Nick Jenkins 2006-07-06 23:24:29 UTC
Omitting the var will still work; but from my understanding using var is
recommended.

Quoting from the Core JavaScript 1.5 Reference (
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Statements:var
) :
"The scope of a variable is the current function or, for variables declared
outside a function, the current application. Using var outside a function is
optional; assigning a value to an undeclared variable implicitly declares it as
a global variable. However, it is recommended to always use var."

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


Navigation
Links