Talk:ResourceLoader/Default modules/Archive

HTML and map modules
I mean e.g. this code: var h = mw.html; var loaderContainer = h.element( 'div', { id: 'ext-foobar-loader' },	new h.Raw( h.element( 'img', {		src: mw.config.get( 'stylepath' ) + '/common/images/ajax-loader.gif',		title: 'Loading...'		}	) ) ); // loaderContainer is '  ' What does this suppose to help with? Maybe the example is bad, but this doesn't seem helpful at all. How is this easier then using innerHTML or even DOM methods? Or maybe it does something extra?

The Map module seems to be at least easier to use, but is it really worth the trouble? It doesn't seem store variables in cookies or localStorage then what is it every day scripter?

Regards, Nux 23:51, 13 February 2011 (UTC)

Hmmm...
The entire mw.html bit except possibly escape seems to be completely useless, mw.config doesn't appear to do anything at all, the mw.legacy object is empty, the mw.user object doesn't appear to have most of the properties listed here (and why would they be functions in the first place, exactly?), mw.util.$content is a jQuery bit without any particular reason for it to be, addOnloadHook is replaced with some odd, seemingly inefficient bit of jQuery... Am I missing something here? --Yair rand 07:23, 15 February 2011 (UTC)
 * (Looks at mw.loader.load source) Ummm... O_O --Yair rand 07:38, 15 February 2011 (UTC)
 * Where are you referring to with "doesn't have most properties". Doesn't have X where, on your wiki ? On Wikipedia ? On MediaWiki.org ? 1.17 is still in development so there may be different versions around. The documentation here describes exactly what the latest version can do, no more (sometimes less since documentation is written afterwards).
 * mediaWiki.legacy is empty because, as the deprecation overview explains, the legacy variables are currently deprecated but not quarantined. Right now we leave a clear window for users to update their scripts. The deprecated functions are at their original locations, for now. During this process we check if the given modern and more compatible replacements in the mw.* library cover all cases without regressions compared to the legacy functions. Once that is completed the functions will be quarantined in mw.legacy so that users who hadn't had the time to convert their scripts can map function calls to mw.legacy as a temporary stop-gap.
 * mediaWiki.loader.load is currently primarily focussed on the loading of (multiple) combined and minified resources including the automatic detection of dependancies etc. That's what it does best and does good. Loading external scripts (or internal ones by full url, like in debug mode) is possible but by no meeans awesome. This has been improved a bit in the trunk development but not yet deployed yet on Wikipedia.
 * the mw.html object is by no means useless, but if you don't need it, don't use it. Krinkle 11:27, 17 February 2011 (UTC)
 * Hm, I thought they were all using the same version. Enwiki, Enwiktionary, and Mediawiki.org all only have the options</tt> propery of mw.user</tt>, and don't have anonymous</tt>, name</tt>, or sessionId</tt>. --Yair rand 11:41, 17 February 2011 (UTC)

$.post.complete is not a function
I tried to use .complete in post but throws error. also i get error if i use  (not a bug in edit mode) ( i think i have to use if( $('#editform') ) ?). Sorry this is a cross posting from Village_pump_(technical). Please help. -- Mahir78 08:37, 26 February 2011 (UTC)
 * Please post a more complete snippet, there's no way of knowing what's wrong with just this. Krinkle 21:01, 2 March 2011 (UTC)

textSelection not working outside edit screen
The jQuery.textSelection seems to be entirely unavailable except on the edit screen. (This is something I really wish I had known earlier...) Whatever the reason might have been for this, wouldn't it make sense to have this bit of information on the page, as well as listing other various jQuery bits that die as soon as the user goes onto a different type of page? --Yair rand 08:33, 4 April 2011 (UTC)
 * There are many modules available, what isn't needed by default is not loaded by default. If you need certain modules it is recommended you invoke your gadget or script like this (even if it's on an edit page, since for all we know it may be removed from the default-on-edit-pages), always declare the dependencies of your script (except for jQuery and the mediaWiki base object such as mw.config mw.util etc.):


 * This will make sure jquery.textSelection is loaded before the code is executed. (either it's already loaded and immediately calls it, or it's loaded right away and then calls it) Krinkle 10:01, 7 April 2011 (UTC)

mediaWiki.util.wikiUrlencode
ISTM this method would be a lot more useful if it reliably returned the same encoding of the title as the parser uses in generating internal links. I have found at least two cases in which it doesn't: Are these bugs, or am I misunderstanding the purpose of this method? --R&#39;n&#39;B 20:48, 15 April 2011 (UTC)
 * 1) The parser converts title to <a href="/w/index.php?title=Title" ...> if the wiki is configured to require uppercase titles, but wikiUrlencode("title") returns "title".
 * 2) The parser converts It's All That to <a href="/w/index.php?title=It's_All_That" ...>, but wikiUrlencode("It's All That") returns "It%27s_All_That".

mw.config.get function?
I don't understand why we use mw.config.get('wgVariable') instead of wgVariable. Is there some pros for using the method? Your answer is appreciated. Thank you. Kwj2772 14:37, 4 June 2011 (UTC)
 * If I understood correctly, the  are deprecated and will removed from global namespace. Using the   method of   will ensure the scripts still works when   is set to   in the future. See also:
 * 69472, where it is said that  "will not change until we are 100% ready to turn off legacy globals"
 * 87856, which solves Bug 28916 by introducing the configuration variable . Such variable was described as follows:
 * Whether or not to assing configuration variables to the global window object. If this is set to false, old code using deprecated variables like " " or " " will no longer work and needs to use  instead. For example " " or " ".
 * I don't know when they are planning to change  to false, but I hope the information above helps you. Helder 14:10, 7 June 2011 (UTC)

mw.util.$content undefined in Modern
I wonder why  seems to be empty in Modern skin; I looked at the current mediawiki.util.js and some older versions and they look fine. —AlexSm 18:31, 31 August 2011 (UTC)