News for hackers. Stuff that matters.
Re:Bling – the $ of jQuery without the jQuery by nailer on Monday June 15, 2015 @06:37AM (#9718528)
>> Tries to play it cool by wrecking jQuery?

> not sure exactly how he's "wrecking jQuery"

The grandparent is misguided, but I believe they mean using '$' as the QSA. The grandparent probably uses script tags and globals in which case there would be a conflict if a script tag library requires window.$.

JS modules should var $ = require('jquery') (or equivalent) and then use the $ in their local scope if they need jquery.

Re:Bling – the $ of jQuery without the jQuery by tracker1 on Monday June 15, 2015 @07:55AM (#9718757)
IIRC, there is a jQuery global object available.. you can assign it to a local variable inside in iife, which is the appropriate way to use jQuery when writing a module...

    (function(window,$){
      //module code goes here
    }(this.self || this, jQuery));
In this way, you are keeping jQuery itself and your implicit scope assigned to localized variables.

If you are writing a modern module (not necessarily jQuery based), then following node/cjs conventions is probably best. If you use this convention with such a plugin, said module should probably return the jQuery object that has been modified, and extra care should be taken that all plugins are using compatible/same instance of jQuery.

Re:Bling – the $ of jQuery without the jQuery by bad_user on Monday June 15, 2015 @06:43AM (#9718547)
What modules? You mean CommonJS or was it AMD or ECMAScript 6? Still a straw man IMHO :-)
Re:Bling – the $ of jQuery without the jQuery by nailer on Monday June 15, 2015 @10:16AM (#9719369)
CommonJS, since npm (which is mainly commonjs) is a few hundred/thousand times larger than the whatever else.