

5 Things You Should Stop Doing With jQuery - remotesynth
http://flippinawesome.org/2013/05/06/5-things-you-should-stop-doing-with-jquery/

======
benlinton
As far as I know, you should still use document ready. Putting javascript at
the bottom does not ensure the dom is loaded before the javascript executes.
Most of the time it probably is, but it's definitely not a certainty.

And not all javascript goes at the bottom, only deferable javascript belongs
there. The problem caused by scripts is that they block parallel downloads. To
prevent that we put as many at the bottom as is possible. But some still
belong at the top if they're non-deferable; in otherwords if they should load
before the dom (e.g. modernizr).

As an added fun fact: In every scenario all external CSS should load before
all javascript because CSS doesn't block parallel downloads. And page display
should be top priority in the load order.

------
electrichead
Ironically, the .map example is actually a bit of a waste. A better function
in that case is to use .filter: .map really should be used when your resultant
array is the same length as the initial array, except with different elements
i.e. [1,2,3,4] to [2,4,6,8], where the same function was applied to each
element. For array manipulation, it is often better to use underscore.js

Edit: I just read the bit about how grep was better than your .map usage. I
still think filter is better than grep in a lot of cases, esp. when you are
trying to chain methods when working with an array of (jQuery) elements

------
netcraft
The site seems to be down. Text Only Cached version:
[http://webcache.googleusercontent.com/search?q=cache:flippin...](http://webcache.googleusercontent.com/search?q=cache:flippinawesome.org/2013/05/06/5-things-
you-should-stop-doing-with-jquery/&strip=1)

------
remotesynth
Sorry. Traffic spike took down the site temporarily...coming back up now.

------
netcraft
Is there a performance penalty for using document ready? Understanding that it
isn't necessary if your scripts are at the bottom of the page, does it
actually hurt?

