Template talk:Editnotices/Namespace/MediaWiki
Jump to navigation
Jump to search
This is the discussion page of the notice for the MediaWiki namespace. Template:Editnotices/Namespace/MediaWiki can only be edited by administrators. All editnotices (except those in userspace) are protected via MediaWiki:Titleblacklist, so the "protection" status as set by the protection tab is irrelevant. To request a change to the page, add {{Edit request}} to this page, followed by a description of your request. Template:Editnotices/Namespace/MediaWiki is marked with the CSS id name "#mediawiki-namespace-editnotice", so that editors can apply their own CSS customization if they wish to hide it.) |
JSHint[edit]
seems to be seriuously buggy:
if (foo) var bar = 'text' else var bar = 'nontext' bar.toUpperCase // Throws "bar used out of scope." if (typeof(DelReqHandler) == 'undefined') //throws DelReqHandler not defined.
--DieBuche (talk) 10:16, 24 February 2011 (UTC)
- Well, given that you define bar in an if-statement I think it's a valid error. For future development I think it's important to not assume something was defined in an if-statement. Instead define the variable's scope before the statement and overwrite as needed. And typeof() throws an error because typeof() is not a function! And if it would be, passing it an undefined variable throws an error (Yes in most browsers typeof can be used in a function-like way, but it's not a function)
var bar = 'nontext'; if (foo) { bar = 'text'; } bar.toUpperCase(); if ( typeof DelReqHandler == 'undefined') alert(foo);
- No errors there. –Krinkletalk 16:58, 12 March 2011 (UTC)
- Sorry, I didn't see this thread until after I made this edit. –Krinkletalk 17:07, 12 March 2011 (UTC)