Last modified: 2006-07-06 23:24:29 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'); ======================================
Created attachment 2052 [details] Wikibits var declarations Attaching diff with var declarations as per above.
r15372.
Thank you!
Er, what's wrong here? These are global declarations.
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."