It increases the parallelism available. (Most browsers will only download 3 or 4 files at a time from any given site.)
It increases the chance that there will be a cache-hit. (As more sites follow this practice, more users already have the file ready.)
It ensures that the payload will be as small as possible. (Google can pre-compress the file in a wide array of formats (like GZIP or DEFLATE). This makes the time-to-download very small, because it is super compressed and it isn't compressed on the fly.)
It reduces the amount of bandwidth used by your server. (Google is basically offering free bandwidth.)
It ensures that the user will get a geographically close response. (Google has servers all over the world, further decreasing the latency.)
(Optional) They will automatically keep your scripts up to date. (If you like to "fly by the seat of your pants," you can always use the latest version of any script that they offer. These could fix security holes, but generally just break your stuff.)
Does it actually matter which CDN you use to link to your jquery file or any javascript file for that matter. Is one potentially faster than the other? What other factors could play a role in which cdn you decide …
With:
if(element.hasClass("class"))
I can check for one class, but is there an easy way to check whether "element" has any of many classes?
I am using:
if(element.hasClass("class") || element.hasClass("class") ... )
Which isn't too bad, …
For the purpose of this question lets say we need to append() 1000 objects to the body element.
You could go about it like this:
for(x = 0; x < 1000; x++) {
var element = $('<div>'+x+'</div&…