Daniel Friesen wrote: > Roan Kattouw wrote: >> 2009/11/27 Tim Starling <[email protected]>: >> >> ... >>> loadGM(), gM(): misnamed, neither should be global, excessively >>> abbreviated and unintelligible function names. I suggest adding >>> mw.getMsg() and mw.addMessages() to wikibits.js. >>> >>> $j: idiosyncratic, what's wrong with calling jQuery jQuery like >>> everyone else? >>> >>> >> I have no idea why that was done. Note that the 'normal' alias for >> jQuery (the one it also defines itself) is $ . >> > I believe I read a note saying it was for compatibility with other > javascript libraries that set $ to other things. > > IMHO the recommended technique should just be used instead of another alias: > (function($) { > // your code here > })(jQuery);
Pretty much every modern JavaScript library defines a function called $, I was quite astonished at that when I reviewed them. I see now that the jQuery documentation recommends $j as an alias for jQuery, so calling it idiosyncratic may have been unfair: <http://docs.jquery.com/Using_jQuery_with_Other_Libraries#Referencing_Magic_-_Shortcuts_for_jQuery> "If you don't like typing the full "jQuery" all the time, there are some alternative shortcuts:" I'm one of those people who doesn't mind typing the full "jQuery" all the time, but I can be flexible if others have other opinions. -- Tim Starling _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
